LibreOffice Module sw (master)  1
WriterInspectorTextPanel.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
21 
22 #include <doc.hxx>
23 #include <ndtxt.hxx>
24 #include <docsh.hxx>
25 #include <wrtsh.hxx>
26 #include <unoprnms.hxx>
27 #include <editeng/unoprnms.hxx>
28 #include <com/sun/star/text/XTextRange.hpp>
29 #include <com/sun/star/text/XTextCursor.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/beans/XPropertyState.hpp>
32 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
33 #include <com/sun/star/lang/IllegalArgumentException.hpp>
34 
35 #include <unotextrange.hxx>
36 #include <comphelper/string.hxx>
38 #include <unotools/intlwrapper.hxx>
39 #include <vcl/settings.hxx>
40 #include <inspectorproperties.hrc>
41 
42 namespace sw::sidebar
43 {
45  const uno::Reference<frame::XFrame>& rxFrame)
46 {
47  if (pParent == nullptr)
48  throw lang::IllegalArgumentException(
49  "no parent Window given to WriterInspectorTextPanel::Create", nullptr, 0);
50  if (!rxFrame.is())
51  throw lang::IllegalArgumentException("no XFrame given to WriterInspectorTextPanel::Create",
52  nullptr, 1);
53 
54  return VclPtr<WriterInspectorTextPanel>::Create(pParent, rxFrame);
55 }
56 
58  const uno::Reference<frame::XFrame>& rxFrame)
59  : InspectorTextPanel(pParent, rxFrame)
60 {
61  SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
62  m_pShell = pDocSh->GetWrtShell();
63  if (m_pShell)
64  {
66  m_pShell->SetChgLnk(LINK(this, WriterInspectorTextPanel, AttrChangedNotify));
67  }
68 }
69 
71 
73 {
75 
77 }
78 
79 static OUString PropertyNametoRID(const OUString& rName)
80 {
81  static const std::map<OUString, const char*> aNameToRID = {
82  { "BorderDistance", RID_BORDER_DISTANCE },
83  { "BottomBorder", RID_BOTTOM_BORDER },
84  { "BottomBorderDistance", RID_BOTTOM_BORDER_DISTANCE },
85  { "BreakType", RID_BREAK_TYPE },
86  { "Category", RID_CATEGORY },
87  { "Cell", RID_CELL },
88  { "CharAutoEscapement", RID_CHAR_AUTO_ESCAPEMENT },
89  { "CharAutoKerning", RID_CHAR_AUTO_KERNING },
90  { "CharAutoStyleName", RID_CHAR_AUTO_STYLE_NAME },
91  { "CharBackColor", RID_CHAR_BACK_COLOR },
92  { "CharBackTransparent", RID_CHAR_BACK_TRANSPARENT },
93  { "CharBorderDistance", RID_CHAR_BORDER_DISTANCE },
94  { "CharBottomBorder", RID_CHAR_BOTTOM_BORDER },
95  { "CharBottomBorderDistance", RID_CHAR_BOTTOM_BORDER_DISTANCE },
96  { "CharCaseMap", RID_CHAR_CASE_MAP },
97  { "CharColor", RID_CHAR_COLOR },
98  { "CharCombineIsOn", RID_CHAR_COMBINE_IS_ON },
99  { "CharCombinePrefix", RID_CHAR_COMBINE_PREFIX },
100  { "CharCombineSuffix", RID_CHAR_COMBINE_SUFFIX },
101  { "CharContoured", RID_CHAR_CONTOURED },
102  { "CharCrossedOut", RID_CHAR_CROSSED_OUT },
103  { "CharDiffHeight", RID_CHAR_DIFF_HEIGHT },
104  { "CharDiffHeightAsian", RID_CHAR_DIFF_HEIGHT_ASIAN },
105  { "CharDiffHeightComplex", RID_CHAR_DIFF_HEIGHT_COMPLEX },
106  { "CharEmphasis", RID_CHAR_EMPHASIS },
107  { "CharEscapement", RID_CHAR_ESCAPEMENT },
108  { "CharEscapementHeight", RID_CHAR_ESCAPEMENT_HEIGHT },
109  { "CharFlash", RID_CHAR_FLASH },
110  { "CharFontCharSet", RID_CHAR_FONT_CHAR_SET },
111  { "CharFontCharSetAsian", RID_CHAR_FONT_CHAR_SET_ASIAN },
112  { "CharFontCharSetComplex", RID_CHAR_FONT_CHAR_SET_COMPLEX },
113  { "CharFontFamily", RID_CHAR_FONT_FAMILY },
114  { "CharFontFamilyAsian", RID_CHAR_FONT_FAMILY_ASIAN },
115  { "CharFontFamilyComplex", RID_CHAR_FONT_FAMILY_COMPLEX },
116  { "CharFontName", RID_CHAR_FONT_NAME },
117  { "CharFontNameAsian", RID_CHAR_FONT_NAME_ASIAN },
118  { "CharFontNameComplex", RID_CHAR_FONT_NAME_COMPLEX },
119  { "CharFontPitch", RID_CHAR_FONT_PITCH },
120  { "CharFontPitchAsian", RID_CHAR_FONT_PITCH_ASIAN },
121  { "CharFontPitchComplex", RID_CHAR_FONT_PITCH_COMPLEX },
122  { "CharFontStyleName", RID_CHAR_FONT_STYLE_NAME },
123  { "CharFontStyleNameAsian", RID_CHAR_FONT_STYLE_NAME_ASIAN },
124  { "CharFontStyleNameComplex", RID_CHAR_FONT_STYLE_NAME_COMPLEX },
125  { "CharHeight", RID_CHAR_HEIGHT },
126  { "CharHeightAsian", RID_CHAR_HEIGHT_ASIAN },
127  { "CharHeightComplex", RID_CHAR_HEIGHT_COMPLEX },
128  { "CharHidden", RID_CHAR_HIDDEN },
129  { "CharHighlight", RID_CHAR_HIGHLIGHT },
130  { "CharInteropGrabBag", RID_CHAR_INTEROP_GRAB_BAG },
131  { "CharKerning", RID_CHAR_KERNING },
132  { "CharLeftBorder", RID_CHAR_LEFT_BORDER },
133  { "CharLeftBorderDistance", RID_CHAR_LEFT_BORDER_DISTANCE },
134  { "CharLocale", RID_CHAR_LOCALE },
135  { "CharLocaleAsian", RID_CHAR_LOCALE_ASIAN },
136  { "CharLocaleComplex", RID_CHAR_LOCALE_COMPLEX },
137  { "CharNoHyphenation", RID_CHAR_NO_HYPHENATION },
138  { "CharOverline", RID_CHAR_OVERLINE },
139  { "CharOverlineColor", RID_CHAR_OVERLINE_COLOR },
140  { "CharOverlineHasColor", RID_CHAR_OVERLINE_HAS_COLOR },
141  { "CharPosture", RID_CHAR_POSTURE },
142  { "CharPostureAsian", RID_CHAR_POSTURE_ASIAN },
143  { "CharPostureComplex", RID_CHAR_POSTURE_COMPLEX },
144  { "CharPropHeight", RID_CHAR_PROP_HEIGHT },
145  { "CharPropHeightAsian", RID_CHAR_PROP_HEIGHT_ASIAN },
146  { "CharPropHeightComplex", RID_CHAR_PROP_HEIGHT_COMPLEX },
147  { "CharRelief", RID_CHAR_RELIEF },
148  { "CharRightBorder", RID_CHAR_RIGHT_BORDER },
149  { "CharRightBorderDistance", RID_CHAR_RIGHT_BORDER_DISTANCE },
150  { "CharRotation", RID_CHAR_ROTATION },
151  { "CharRotationIsFitToLine", RID_CHAR_ROTATION_IS_FIT_TO_LINE },
152  { "CharScaleWidth", RID_CHAR_SCALE_WIDTH },
153  { "CharShadingValue", RID_CHAR_SHADING_VALUE },
154  { "CharShadowFormat", RID_CHAR_SHADOW_FORMAT },
155  { "CharShadowed", RID_CHAR_SHADOWED },
156  { "CharStrikeout", RID_CHAR_STRIKEOUT },
157  { "CharStyleName", RID_CHAR_STYLE_NAME },
158  { "CharStyleNames", RID_CHAR_STYLE_NAMES },
159  { "CharTopBorder", RID_CHAR_TOP_BORDER },
160  { "CharTopBorderDistance", RID_CHAR_TOP_BORDER_DISTANCE },
161  { "CharTransparence", RID_CHAR_TRANSPARENCE },
162  { "CharUnderline", RID_CHAR_UNDERLINE },
163  { "CharUnderlineColor", RID_CHAR_UNDERLINE_COLOR },
164  { "CharUnderlineHasColor", RID_CHAR_UNDERLINE_HAS_COLOR },
165  { "CharWeight", RID_CHAR_WEIGHT },
166  { "CharWeightAsian", RID_CHAR_WEIGHT_ASIAN },
167  { "CharWeightComplex", RID_CHAR_WEIGHT_COMPLEX },
168  { "CharWordMode", RID_CHAR_WORD_MODE },
169  { "ContinueingPreviousSubTree", RID_CONTINUING_PREVIOUS_SUB_TREE },
170  { "DisplayName", RID_DISPLAY_NAME },
171  { "DocumentIndex", RID_DOCUMENT_INDEX },
172  { "DocumentIndexMark", RID_DOCUMENT_INDEX_MARK },
173  { "DropCapCharStyleName", RID_DROP_CAP_CHAR_STYLE_NAME },
174  { "DropCapFormat", RID_DROP_CAP_FORMAT },
175  { "DropCapWholeWord", RID_DROP_CAP_WHOLE_WORD },
176  { "Endnote", RID_ENDNOTE },
177  { "FillBackground", RID_FILL_BACKGROUND },
178  { "FillBitmap", RID_FILL_BITMAP },
179  { "FillBitmapLogicalSize", RID_FILL_BITMAP_LOGICAL_SIZE },
180  { "FillBitmapMode", RID_FILL_BITMAP_MODE },
181  { "FillBitmapName", RID_FILL_BITMAP_NAME },
182  { "FillBitmapOffsetX", RID_FILL_BITMAP_OFFSET_X },
183  { "FillBitmapOffsetY", RID_FILL_BITMAP_OFFSET_Y },
184  { "FillBitmapPositionOffsetX", RID_FILL_BITMAP_POSITION_OFFSET_X },
185  { "FillBitmapPositionOffsetY", RID_FILL_BITMAP_POSITION_OFFSET_Y },
186  { "FillBitmapRectanglePoint", RID_FILL_BITMAP_RECTANGLE_POINT },
187  { "FillBitmapSizeX", RID_FILL_BITMAP_SIZE_X },
188  { "FillBitmapSizeY", RID_FILL_BITMAP_SIZE_Y },
189  { "FillBitmapStretch", RID_FILL_BITMAP_STRETCH },
190  { "FillBitmapTile", RID_FILL_BITMAP_TILE },
191  { "FillBitmapURL", RID_FILL_BITMAP_URL },
192  { "FillColor", RID_FILL_COLOR },
193  { "FillColor2", RID_FILL_COLOR2 },
194  { "FillGradient", RID_FILL_GRADIENT },
195  { "FillGradientName", RID_FILL_GRADIENT_NAME },
196  { "FillGradientStepCount", RID_FILL_GRADIENT_STEP_COUNT },
197  { "FillHatch", RID_FILL_HATCH },
198  { "FillHatchName", RID_FILL_HATCH_NAME },
199  { "FillStyle", RID_FILL_STYLE },
200  { "FillTransparence", RID_FILL_TRANSPARENCE },
201  { "FillTransparenceGradient", RID_FILL_TRANSPARENCE_GRADIENT },
202  { "FillTransparenceGradientName", RID_FILL_TRANSPARENCE_GRADIENT_NAME },
203  { "FollowStyle", RID_FOLLOW_STYLE },
204  { "Footnote", RID_FOOTNOTE },
205  { "Hidden", RID_HIDDEN },
206  { "HyperLinkEvents", RID_HYPERLINK_EVENTS },
207  { "HyperLinkName", RID_HYPERLINK_NAME },
208  { "HyperLinkTarget", RID_HYPERLINK_TARGET },
209  { "HyperLinkURL", RID_HYPERLINK_URL },
210  { "IsAutoUpdate", RID_IS_AUTO_UPDATE },
211  { "IsPhysical", RID_IS_PHYSICAL },
212  { "LeftBorder", RID_LEFT_BORDER },
213  { "LeftBorderDistance", RID_LEFT_BORDER_DISTANCE },
214  { "ListAutoFormat", RID_LIST_AUTO_FORMAT },
215  { "ListId", RID_LIST_ID },
216  { "ListLabelString", RID_LIST_LABEL_STRING },
217  { "NestedTextContent", RID_NESTED_TEXT_CONTENT },
218  { "NumberingIsNumber", RID_NUMBERING_IS_NUMBER },
219  { "NumberingLevel", RID_NUMBERING_LEVEL },
220  { "NumberingRules", RID_NUMBERING_RULES },
221  { "NumberingStartValue", RID_NUMBERING_START_VALUE },
222  { "NumberingStyleName", RID_NUMBERING_STYLE_NAME },
223  { "OutlineContentVisible", RID_OUTLINE_CONTENT_VISIBLE },
224  { "OutlineLevel", RID_OUTLINE_LEVEL },
225  { "PageDescName", RID_PAGE_DESC_NAME },
226  { "PageNumberOffset", RID_PAGE_NUMBER_OFFSET },
227  { "PageStyleName", RID_PAGE_STYLE_NAME },
228  { "ParRsid", RID_PAR_RSID },
229  { "ParaAdjust", RID_PARA_ADJUST },
230  { "ParaAutoStyleName", RID_PARA_AUTO_STYLE_NAME },
231  { "ParaBackColor", RID_PARA_BACK_COLOR },
232  { "ParaBackGraphic", RID_PARA_BACK_GRAPHIC },
233  { "ParaBackGraphicFilter", RID_PARA_BACK_GRAPHIC_FILTER },
234  { "ParaBackGraphicLocation", RID_PARA_BACK_GRAPHIC_LOCATION },
235  { "ParaBackGraphicURL", RID_PARA_BACK_GRAPHIC_URL },
236  { "ParaBackTransparent", RID_PARA_BACK_TRANSPARENT },
237  { "ParaBottomMargin", RID_PARA_BOTTOM_MARGIN },
238  { "ParaBottomMarginRelative", RID_PARA_BOTTOM_MARGIN_RELATIVE },
239  { "ParaChapterNumberingLevel", RID_PARA_CHAPTER_NUMBERING_LEVEL },
240  { "ParaConditionalStyleName", RID_PARA_CONDITIONAL_STYLE_NAME },
241  { "ParaContextMargin", RID_PARA_CONTEXT_MARGIN },
242  { "ParaExpandSingleWord", RID_PARA_EXPAND_SINGLE_WORD },
243  { "ParaFirstLineIndent", RID_PARA_FIRST_LINE_INDENT },
244  { "ParaFirstLineIndentRelative", RID_PARA_FIRST_LINE_INDENT_RELATIVE },
245  { "ParaHyphenationMaxHyphens", RID_PARA_HYPHENATION_MAX_HYPHENS },
246  { "ParaHyphenationMaxLeadingChars", RID_PARA_HYPHENATION_MAX_LEADING_CHARS },
247  { "ParaHyphenationMaxTrailingChars", RID_PARA_HYPHENATION_MAX_TRAILING_CHARS },
248  { "ParaHyphenationNoCaps", RID_PARA_HYPHENATION_NO_CAPS },
249  { "ParaInteropGrabBag", RID_PARA_INTEROP_GRAB_BAG },
250  { "ParaIsAutoFirstLineIndent", RID_PARA_IS_AUTO_FIRST_LINE_INDENT },
251  { "ParaIsCharacterDistance", RID_PARA_IS_CHARACTER_DISTANCE },
252  { "ParaIsConnectBorder", RID_PARA_IS_CONNECT_BORDER },
253  { "ParaIsForbiddenRules", RID_PARA_IS_FORBIDDEN_RULES },
254  { "ParaIsHangingPunctuation", RID_PARA_IS_HANGING_PUNCTUATION },
255  { "ParaIsHyphenation", RID_PARA_IS_HYPHENATION },
256  { "ParaIsNumberingRestart", RID_PARA_IS_NUMBERING_RESTART },
257  { "ParaKeepTogether", RID_PARA_KEEP_TOGETHER },
258  { "ParaLastLineAdjust", RID_PARA_LAST_LINE_ADJUST },
259  { "ParaLeftMargin", RID_PARA_LEFT_MARGIN },
260  { "ParaLeftMarginRelative", RID_PARA_LEFT_MARGIN_RELATIVE },
261  { "ParaLineNumberCount", RID_PARA_LINE_NUMBER_COUNT },
262  { "ParaLineNumberStartValue", RID_PARA_LINE_NUMBER_START_VALUE },
263  { "ParaLineSpacing", RID_PARA_LINE_SPACING },
264  { "ParaOrphans", RID_PARA_ORPHANS },
265  { "ParaRegisterModeActive", RID_PARA_REGISTER_MODE_ACTIVE },
266  { "ParaRightMargin", RID_PARA_RIGHT_MARGIN },
267  { "ParaRightMarginRelative", RID_PARA_RIGHT_MARGIN_RELATIVE },
268  { "ParaShadowFormat", RID_PARA_SHADOW_FORMAT },
269  { "ParaSplit", RID_PARA_SPLIT },
270  { "ParaStyleName", RID_PARA_STYLE_NAME },
271  { "ParaTabStops", RID_PARA_TAB_STOPS },
272  { "ParaTopMargin", RID_PARA_TOP_MARGIN },
273  { "ParaTopMarginRelative", RID_PARA_TOP_MARGIN_RELATIVE },
274  { "ParaUserDefinedAttributes", RID_PARA_USER_DEFINED_ATTRIBUTES },
275  { "ParaVertAlignment", RID_PARA_VERT_ALIGNMENT },
276  { "ParaWidows", RID_PARA_WIDOWS },
277  { "ReferenceMark", RID_REFERENCE_MARK },
278  { "RightBorder", RID_RIGHT_BORDER },
279  { "RightBorderDistance", RID_RIGHT_BORDER_DISTANCE },
280  { "Rsid", RID_RSID },
281  { "RubyAdjust", RID_RUBY_ADJUST },
282  { "RubyCharStyleName", RID_RUBY_CHAR_STYLE_NAME },
283  { "RubyIsAbove", RID_RUBY_IS_ABOVE },
284  { "RubyPosition", RID_RUBY_POSITION },
285  { "RubyText", RID_RUBY_TEXT },
286  { "SnapToGrid", RID_SNAP_TO_GRID },
287  { "StyleInteropGrabBag", RID_STYLE_INTEROP_GRAB_BAG },
288  { "TextField", RID_TEXT_FIELD },
289  { "TextFrame", RID_TEXT_FRAME },
290  { "TextParagraph", RID_TEXT_PARAGRAPH },
291  { "TextSection", RID_TEXT_SECTION },
292  { "TextTable", RID_TEXT_TABLE },
293  { "TextUserDefinedAttributes", RID_TEXT_USER_DEFINED_ATTRIBUTES },
294  { "TopBorder", RID_TOP_BORDER },
295  { "TopBorderDistance", RID_TOP_BORDER_DISTANCE },
296  { "UnvisitedCharStyleName", RID_UNVISITED_CHAR_STYLE_NAME },
297  { "VisitedCharStyleName", RID_VISITED_CHAR_STYLE_NAME },
298  { "WritingMode", RID_WRITING_MODE },
299  };
300 
301  auto itr = aNameToRID.find(rName);
302  if (itr != aNameToRID.end())
303  return SwResId(itr->second);
304  return rName;
305 }
306 
307 static void InsertValues(const css::uno::Reference<css::uno::XInterface>& rSource,
308  std::unordered_map<OUString, bool>& rIsDefined,
309  svx::sidebar::TreeNode& rNode, const bool& isRoot,
310  const std::vector<OUString>& rHiddenProperty)
311 {
312  uno::Reference<beans::XPropertySet> xPropertiesSet(rSource, uno::UNO_QUERY_THROW);
313  uno::Reference<beans::XPropertyState> xPropertiesState(rSource, uno::UNO_QUERY_THROW);
314  const uno::Sequence<beans::Property> aProperties
315  = xPropertiesSet->getPropertySetInfo()->getProperties();
316 
317  for (const beans::Property& rProperty : aProperties)
318  {
319  if (std::find(rHiddenProperty.begin(), rHiddenProperty.end(), rProperty.Name)
320  != rHiddenProperty.end())
321  continue;
322  if (isRoot
323  || xPropertiesState->getPropertyState(rProperty.Name)
324  == beans::PropertyState_DIRECT_VALUE)
325  {
326  const uno::Any aAny = xPropertiesSet->getPropertyValue(rProperty.Name);
328  if (rIsDefined[rProperty.Name])
329  aTemp.isGrey = true;
330  rIsDefined[rProperty.Name] = true;
331  aTemp.sNodeName = PropertyNametoRID(rProperty.Name);
332  aTemp.aValue = aAny;
333  rNode.children.push_back(aTemp);
334  }
335  }
336 
339  Application::GetSettings().GetUILanguageTag().getLocale());
340 
341  std::sort(
342  rNode.children.begin(), rNode.children.end(),
343  [&aSorter](svx::sidebar::TreeNode const& rEntry1, svx::sidebar::TreeNode const& rEntry2) {
344  return aSorter.compare(rEntry1.sNodeName, rEntry2.sNodeName) < 0;
345  });
346 }
347 
348 static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>& aStore)
349 {
350  SwDoc* pDoc = pDocSh->GetDoc();
351  SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
352  svx::sidebar::TreeNode aDFNode;
353  svx::sidebar::TreeNode aCharNode;
354  svx::sidebar::TreeNode aParaNode;
355 
356  aDFNode.sNodeName = "Direct Formatting";
357  aCharNode.sNodeName = "Character Styles";
358  aParaNode.sNodeName = "Paragraph Styles";
362 
363  uno::Reference<text::XTextRange> xRange(
364  SwXTextRange::CreateXTextRange(*pDoc, *pCursor->GetPoint(), nullptr));
365  uno::Reference<beans::XPropertySet> xPropertiesSet(xRange, uno::UNO_QUERY_THROW);
366  std::unordered_map<OUString, bool> aIsDefined;
367 
368  InsertValues(xRange, aIsDefined, aDFNode, false,
374 
375  uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocSh->GetBaseModel(),
376  uno::UNO_QUERY);
377  uno::Reference<container::XNameAccess> xStyleFamilies
378  = xStyleFamiliesSupplier->getStyleFamilies();
379  OUString sCurrentCharStyle, sCurrentParaStyle, sDisplayName;
380 
381  uno::Reference<container::XNameAccess> xStyleFamily(
382  xStyleFamilies->getByName("CharacterStyles"), uno::UNO_QUERY_THROW);
383  xPropertiesSet->getPropertyValue("CharStyleName") >>= sCurrentCharStyle;
384  xPropertiesSet->getPropertyValue("ParaStyleName") >>= sCurrentParaStyle;
385 
386  if (!sCurrentCharStyle.isEmpty())
387  {
388  xPropertiesSet.set(xStyleFamily->getByName(sCurrentCharStyle), css::uno::UNO_QUERY_THROW);
389  xPropertiesSet->getPropertyValue("DisplayName") >>= sDisplayName;
390  svx::sidebar::TreeNode aCurrentChild;
391  aCurrentChild.sNodeName = sDisplayName;
393 
394  InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, false, {});
395 
396  aCharNode.children.push_back(aCurrentChild);
397  }
398 
399  xStyleFamily.set(xStyleFamilies->getByName("ParagraphStyles"), uno::UNO_QUERY_THROW);
400 
401  while (!sCurrentParaStyle.isEmpty())
402  {
403  uno::Reference<style::XStyle> xPropertiesStyle(xStyleFamily->getByName(sCurrentParaStyle),
404  uno::UNO_QUERY_THROW);
405  xPropertiesSet.set(xPropertiesStyle, css::uno::UNO_QUERY_THROW);
406  xPropertiesSet->getPropertyValue("DisplayName") >>= sDisplayName;
407  OUString aParentParaStyle = xPropertiesStyle->getParentStyle();
408  svx::sidebar::TreeNode aCurrentChild;
409  aCurrentChild.sNodeName = sDisplayName;
411 
412  InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, aParentParaStyle.isEmpty(), {});
413 
414  aParaNode.children.push_back(aCurrentChild);
415  sCurrentParaStyle = aParentParaStyle;
416  }
417 
418  std::reverse(aParaNode.children.begin(),
419  aParaNode.children.end()); // Parent style should be first then children
420 
421  /*
422  Display Order :-
423  PARAGRAPH STYLE
424  CHARACTER STYLE
425  DIRECT FORMATTING
426  */
427  aStore.push_back(aParaNode);
428  aStore.push_back(aCharNode);
429  aStore.push_back(aDFNode);
430 }
431 
432 IMPL_LINK(WriterInspectorTextPanel, AttrChangedNotify, LinkParamNone*, pLink, void)
433 {
434  if (m_oldLink.IsSet())
435  m_oldLink.Call(pLink);
436 
437  SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
438  std::vector<svx::sidebar::TreeNode> aStore;
439 
440  if (pDocSh && pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetNode().GetTextNode())
441  UpdateTree(pDocSh, aStore);
442 
443  updateEntries(aStore);
444 }
445 
446 } // end of namespace svx::sidebar
447 
448 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
#define UNO_NAME_RSID
Definition: unoprnms.hxx:816
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:189
static const AllSettings & GetSettings()
#define UNO_NAME_PARA_STYLE_NAME
Definition: unoprnms.hxx:171
Definition: doc.hxx:184
IMPL_LINK(PageColumnControl, ColumnButtonClickHdl_Impl, weld::Button &, rButton, void)
static SfxObjectShell * Current()
#define UNO_NAME_PARA_CONDITIONAL_STYLE_NAME
Definition: unoprnms.hxx:462
static void InsertValues(const css::uno::Reference< css::uno::XInterface > &rSource, std::unordered_map< OUString, bool > &rIsDefined, svx::sidebar::TreeNode &rNode, const bool &isRoot, const std::vector< OUString > &rHiddenProperty)
PropertiesInfo aProperties
static VclPtr< vcl::Window > Create(vcl::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame)
css::uno::Reference< css::frame::XModel > GetBaseModel() const
enum svx::sidebar::TreeNode::@3 NodeType
void SetChgLnk(const Link< LinkParamNone *, void > &rLnk)
Definition: crsrsh.hxx:483
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
css::uno::Any aValue
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:327
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
WriterInspectorTextPanel(vcl::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
#define UNO_NAME_NUMBERING_START_VALUE
Definition: unoprnms.hxx:147
std::vector< TreeNode > children
const Link< LinkParamNone *, void > & GetChgLnk() const
Definition: crsrsh.hxx:484
#define UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE
Definition: unoprnms.hxx:800
const LanguageTag & getLocale()
#define UNO_NAME_NUMBERING_IS_NUMBER
Definition: unoprnms.hxx:148
const char UNO_NAME_CHAR_STYLE_NAME[]
SvBaseLink * pLink
static OUString PropertyNametoRID(const OUString &rName)
#define UNO_NAME_PARA_IS_NUMBERING_RESTART
Definition: unoprnms.hxx:487
static VclPtr< reference_type > Create(Arg &&...arg)
Reference< XComponentContext > getProcessComponentContext()
static void UpdateTree(SwDocShell *pDocSh, std::vector< svx::sidebar::TreeNode > &aStore)
sal_Int32 compare(const OUString &rLHS, const OUString &rRHS) const
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1054
#define UNO_NAME_NUMBERING_LEVEL
#define UNO_NAME_PAGE_STYLE_NAME
Definition: unoprnms.hxx:167
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:844
OUString sDisplayName