summaryrefslogtreecommitdiff
path: root/include/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-11-07 20:39:06 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2017-11-08 09:50:14 +0100
commit272a96da03522a82db4185e7858d05375f3ea95e (patch)
tree1ca63aefb0e0d8b9c0fcacfc75d6f8f423e0cac8 /include/sfx2
parent35ca7baca44cc547818324731805fcefde71dd0d (diff)
tdf#100922 Refactor Custom Properties page
This commit solves problems with big number of entries. Window is loaded quickly and is responsive even with over a thousand custom properties. Change-Id: I4745c69aaff95661ca930e303ab65591e374a24d Reviewed-on: https://gerrit.libreoffice.org/44429 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'include/sfx2')
-rw-r--r--include/sfx2/dinfdlg.hxx38
1 files changed, 25 insertions, 13 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index e708d0cf8927..40b8b91c4340 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -379,11 +379,11 @@ struct CustomPropertyLine
ScopedVclPtr<CustomPropertiesYesNoButton> m_aYesNoButton;
ScopedVclPtr<CustomPropertiesRemoveButton> m_aRemoveButton;
- bool m_bIsRemoved;
- bool m_bTypeLostFocus;
+ bool m_bTypeLostFocus;
CustomPropertyLine( vcl::Window* pParent );
- void SetRemoved();
+ void Clear();
+ void Hide();
};
// class CustomPropertiesWindow ------------------------------------------
@@ -402,7 +402,8 @@ private:
sal_Int32 m_nTypeBoxWidth;
sal_Int32 m_nLineHeight;
sal_Int32 m_nScrollPos;
- std::vector< CustomPropertyLine* > m_aCustomPropertiesLines;
+ std::vector<CustomProperty*> m_aCustomProperties;
+ std::vector<CustomPropertyLine*> m_aCustomPropertiesLines;
CustomPropertyLine* m_pCurrentLine;
SvNumberFormatter m_aNumberFormatter;
Idle m_aEditLoseFocusIdle;
@@ -420,6 +421,10 @@ private:
bool IsLineValid( CustomPropertyLine* pLine ) const;
void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox );
+ void CreateNewLine();
+ void ReloadLinesContent();
+ void StoreCustomProperties();
+ sal_uInt32 GetCurrentDataModelPosition() const { return -1 * m_nScrollPos / m_nLineHeight; }
public:
CustomPropertiesWindow(vcl::Window* pParent,
@@ -437,16 +442,20 @@ public:
//non-const contents of the VclPtr, but loplugin:constparams
//correctly sees that it could all be set to const, so we end
//up with this unhappy situation
- void SetWidgetWidths(const CustomPropertyLine* pLine) const;
+ void SetWidgetWidths(const CustomPropertyLine* pLine) const;
+ sal_uInt16 GetExistingLineCount() const { return m_aCustomPropertiesLines.size(); }
+ sal_uInt16 GetTotalLineCount() const { return m_aCustomProperties.size(); }
sal_uInt16 GetVisibleLineCount() const;
- sal_Int32 GetLineHeight() const { return m_nLineHeight; }
+ void SetVisibleLineCount(sal_uInt32 nCount);
+ sal_Int32 GetLineHeight() const { return m_nLineHeight; }
void AddLine( const OUString& sName, css::uno::Any const & rAny );
bool AreAllLinesValid() const;
void ClearAllLines();
void DoScroll( sal_Int32 nNewPos );
css::uno::Sequence< css::beans::PropertyValue >
- GetCustomProperties() const;
+ GetCustomProperties();
+ void SetCustomProperties(const std::vector<CustomProperty*>& rProperties);
void SetRemovedHdl( const Link<void*,void>& rLink ) { m_aRemovedHdl = rLink; }
};
@@ -471,14 +480,17 @@ public:
virtual ~CustomPropertiesControl() override;
virtual void dispose() override;
- void AddLine( const OUString& sName, css::uno::Any const & rAny, bool bInteractive );
+ void AddLine(const OUString& sName, css::uno::Any const & rAny, bool bInteractive);
- bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
- void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
- css::uno::Sequence< css::beans::PropertyValue >
- GetCustomProperties() const
+ bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
+ void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
+
+ css::uno::Sequence<css::beans::PropertyValue>
+ GetCustomProperties() const
{ return m_pPropertiesWin->GetCustomProperties(); }
- void Init(VclBuilderContainer& rParent);
+ void SetCustomProperties(const std::vector<CustomProperty*>& rProperties);
+
+ void Init(VclBuilderContainer& rParent);
virtual void Resize() override;
};