tdf#150712 limit the dialog to only a sample of the data

instead of the entire area, which makes the dialog pretty much
instantaneous

Change-Id: Icb08a09733ee872b67d5be00cb083139f05fba7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139214
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2022-09-02 10:58:04 +02:00
parent 5226e38891
commit b24eceb517
11 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ bool Shell::HasSelection( bool /* bText */ ) const
return false;
}
OUString Shell::GetSelectionText( bool bWholeWord )
OUString Shell::GetSelectionText( bool bWholeWord, bool /*bOnlyASample*/ )
{
OUString aText;
if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
+1 -1
View File
@@ -168,7 +168,7 @@ public:
// virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
virtual OUString GetSelectionText( bool bCompleteWords = false ) override;
virtual OUString GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false ) override;
virtual bool HasSelection( bool bText = true ) const override;
void GetState( SfxItemSet& );
+2 -1
View File
@@ -226,9 +226,10 @@ public:
* Initialize is called after the frame has been loaded and the controller
* has been set. By the time this is called the document has been fully
* imported.
* @param bOnlyASample used by some dialogs to avoid constructing monster strings e.g. in calc
*/
virtual bool PrepareClose( bool bUI = true );
virtual OUString GetSelectionText( bool bCompleteWords = false );
virtual OUString GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false );
virtual bool HasSelection( bool bText = true ) const;
virtual SdrView* GetDrawView() const;
+1 -1
View File
@@ -201,7 +201,7 @@ protected:
virtual void QueryObjAreaPixel( tools::Rectangle& rRect ) const override;
virtual OUString GetSelectionText( bool bWholeWord = false ) override;
virtual OUString GetSelectionText( bool bWholeWord = false, bool bOnlyASample = false ) override;
virtual bool HasSelection( bool bText = true ) const override;
virtual void WriteUserData(OUString &, bool bBrowse = false) override;
+2 -2
View File
@@ -39,7 +39,7 @@
#include <inputhdl.hxx>
#include <document.hxx>
OUString ScTabViewShell::GetSelectionText( bool bWholeWord )
OUString ScTabViewShell::GetSelectionText( bool bWholeWord, bool bOnlyASample )
{
OUString aStrSelection;
@@ -54,7 +54,7 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord )
if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
ScDocument& rDoc = GetViewData().GetDocument();
if ( bInFormatDialog && aRange.aStart.Row() != aRange.aEnd.Row() )
if ( (bOnlyASample || bInFormatDialog) && aRange.aStart.Row() != aRange.aEnd.Row() )
{
// limit range to one data row
// (only when the call comes from a format dialog)
+1 -1
View File
@@ -108,7 +108,7 @@ public:
void GetState (SfxItemSet& rSet);
/* override these from SfxViewShell */
virtual OUString GetSelectionText(bool = false) override;
virtual OUString GetSelectionText(bool = false, bool bOnlyASample = false) override;
virtual bool HasSelection(bool = true ) const override;
SvBorder GetBorder (bool bOuterResize);
+1 -1
View File
@@ -441,7 +441,7 @@ void ViewShellBase::InitializeFramework()
{
}
OUString ViewShellBase::GetSelectionText(bool bCompleteWords)
OUString ViewShellBase::GetSelectionText(bool bCompleteWords, bool /*bOnlyASample*/)
{
std::shared_ptr<ViewShell> const pMainShell(GetMainViewShell());
DrawViewShell *const pDrawViewShell(
+2 -1
View File
@@ -1190,7 +1190,7 @@ SdrView* SfxViewShell::GetDrawView() const
OUString SfxViewShell::GetSelectionText
(
bool /*bCompleteWords*/ /* FALSE (default)
bool /*bCompleteWords*/, /* FALSE (default)
Only the actual selected text is returned.
TRUE
@@ -1199,6 +1199,7 @@ OUString SfxViewShell::GetSelectionText
these are used: white spaces and punctuation
".,;" and single and double quotes.
*/
bool /*bOnlyASample*/ /* used by some dialogs to avoid constructing monster strings e.g. in calc */
)
/* [Description]
+1 -1
View File
@@ -628,7 +628,7 @@ void SvxFontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R
if (pSh && !pImpl->mbGetSelection && !pImpl->mbUseFontNameAsText)
{
pImpl->maText = removeCRLF(pSh->GetSelectionText());
pImpl->maText = removeCRLF(pSh->GetSelectionText(/*bCompleteWords*/false, /*bOnlyASample*/true));
pImpl->mbGetSelection = true;
pImpl->mbSelection = !(pImpl->maText.isEmpty());
}
+1 -1
View File
@@ -397,7 +397,7 @@ public:
OUString GetSelectionTextParam( bool bCompleteWords,
bool bEraseTrail );
virtual bool HasSelection( bool bText = true ) const override;
virtual OUString GetSelectionText( bool bCompleteWords = false ) override;
virtual OUString GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false ) override;
virtual bool PrepareClose( bool bUI = true ) override;
virtual void MarginChanged() override;
+1 -1
View File
@@ -1653,7 +1653,7 @@ bool SwView::HasSelection( bool bText ) const
: GetWrtShell().HasSelection();
}
OUString SwView::GetSelectionText( bool bCompleteWrds )
OUString SwView::GetSelectionText( bool bCompleteWrds, bool /*bOnlyASample*/ )
{
return GetSelectionTextParam( bCompleteWrds, true );
}