LibreOffice Module sw (master)  1
frmpage.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 
20 #include <com/sun/star/embed/Aspects.hpp>
21 #include <com/sun/star/embed/EmbedMisc.hpp>
22 #include <com/sun/star/embed/XEmbeddedObject.hpp>
23 
24 #include <cmdid.h>
25 #include <hintids.hxx>
26 #include <bitmaps.hlst>
27 #include <vcl/mnemonic.hxx>
28 #include <svl/urihelper.hxx>
29 #include <svl/stritem.hxx>
30 #include <sfx2/htmlmode.hxx>
31 #include <editeng/sizeitem.hxx>
32 #include <editeng/opaqitem.hxx>
33 #include <editeng/protitem.hxx>
34 #include <editeng/prntitem.hxx>
35 #include <editeng/brushitem.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <editeng/frmdiritem.hxx>
40 #include <comphelper/classids.hxx>
41 #include <sfx2/viewfrm.hxx>
42 #include <tools/globname.hxx>
43 #include <fmturl.hxx>
44 #include <fmteiro.hxx>
45 #include <fmtcnct.hxx>
46 #include <fmtsrnd.hxx>
47 #include <view.hxx>
48 #include <wrtsh.hxx>
49 #include <swmodule.hxx>
50 #include <uitool.hxx>
51 #include <docsh.hxx>
52 #include <viewopt.hxx>
53 #include <frmatr.hxx>
54 #include <frmdlg.hxx>
55 #include <frmmgr.hxx>
56 #include <frmpage.hxx>
57 #include <wrap.hxx>
58 #include <colmgr.hxx>
59 #include <grfatr.hxx>
60 #include <uiitems.hxx>
61 #include <fmtfollowtextflow.hxx>
62 #include <editeng/adjustitem.hxx>
63 #include <svx/sdtaitm.hxx>
64 #include <sal/macros.h>
65 
66 #include <strings.hrc>
67 #include <svx/strings.hrc>
68 #include <svx/dialmgr.hxx>
69 #include <svx/svxids.hrc>
70 #include <sfx2/filedlghelper.hxx>
71 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
72 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
73 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
74 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
75 #include <vcl/graphicfilter.hxx>
76 #include <svtools/embedhlp.hxx>
77 #include <comphelper/lok.hxx>
78 #include <memory>
79 
80 using namespace ::com::sun::star;
81 using namespace ::sfx2;
82 
83 #define SwFPos SvxSwFramePosString
84 
85 namespace {
86 
87 struct StringIdPair_Impl
88 {
91 };
92 
93 }
94 
95 #define MAX_PERCENT_WIDTH 254
96 #define MAX_PERCENT_HEIGHT 254
97 
98 namespace {
99 
100 enum class LB {
101  NONE = 0x00000000L,
102  Frame = 0x00000001L, // text region of the paragraph
103  PrintArea = 0x00000002L, // text region of the paragraph + indentions
104  VertFrame = 0x00000004L, // vertical text region of the paragraph
105  VertPrintArea = 0x00000008L, // vertical text region of the paragraph + indentions
106  RelFrameLeft = 0x00000010L, // left paragraph edge
107  RelFrameRight = 0x00000020L, // right paragraph edge
108 
109  RelPageLeft = 0x00000040L, // left page edge
110  RelPageRight = 0x00000080L, // right page edge
111  RelPageFrame = 0x00000100L, // whole page
112  RelPagePrintArea = 0x00000200L, // text region of the page
113 
114  FlyRelPageLeft = 0x00000400L, // left frame edge
115  FlyRelPageRight = 0x00000800L, // right frame edge
116  FlyRelPageFrame = 0x00001000L, // whole frame
117  FlyRelPagePrintArea = 0x00002000L, // inside of the frame
118 
119  RelBase = 0x00010000L, // character alignment Base
120  RelChar = 0x00020000L, // character alignment Character
121  RelRow = 0x00040000L, // character alignment Row
122 
123  FlyVertFrame = 0x00100000L, // vertical entire frame
124  FlyVertPrintArea = 0x00200000L, // vertical frame text area
125 
126  VertLine = 0x00400000L, // vertical text line
127 };
128 
129 }
130 
131 namespace o3tl {
132  template<> struct typed_flags<LB> : is_typed_flags<LB, 0x00773fffL> {};
133 }
134 
135 namespace {
136 
137 struct RelationMap
138 {
139  SvxSwFramePosString::StringId const eStrId;
140  SvxSwFramePosString::StringId const eMirrorStrId;
141  LB const nLBRelation;
142  sal_Int16 const nRelation;
143 };
144 
145 }
146 
147 struct FrameMap
148 {
151  sal_Int16 const nAlign;
153 };
154 
155 
156 static RelationMap const aRelationMap[] =
157 {
158  {SwFPos::FRAME, SwFPos::FRAME, LB::Frame, text::RelOrientation::FRAME},
159  {SwFPos::PRTAREA, SwFPos::PRTAREA, LB::PrintArea, text::RelOrientation::PRINT_AREA},
160  {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB::RelPageLeft, text::RelOrientation::PAGE_LEFT},
161  {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB::RelPageRight, text::RelOrientation::PAGE_RIGHT},
162  {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB::RelFrameLeft, text::RelOrientation::FRAME_LEFT},
163  {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB::RelFrameRight, text::RelOrientation::FRAME_RIGHT},
164  {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB::RelPageFrame, text::RelOrientation::PAGE_FRAME},
165  {SwFPos::REL_PG_PRTAREA, SwFPos::REL_PG_PRTAREA, LB::RelPagePrintArea, text::RelOrientation::PAGE_PRINT_AREA},
166  {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB::RelChar, text::RelOrientation::CHAR},
167 
168  {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB::FlyRelPageLeft, text::RelOrientation::PAGE_LEFT},
169  {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB::FlyRelPageRight, text::RelOrientation::PAGE_RIGHT},
170  {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB::FlyRelPageFrame, text::RelOrientation::PAGE_FRAME},
171  {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB::FlyRelPagePrintArea, text::RelOrientation::PAGE_PRINT_AREA},
172 
173  {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB::VertFrame, text::RelOrientation::FRAME},
174  {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB::VertPrintArea, text::RelOrientation::PRINT_AREA},
175 
176  {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB::FlyVertFrame, text::RelOrientation::FRAME},
177  {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB::FlyVertPrintArea, text::RelOrientation::PRINT_AREA},
178 
179  {SwFPos::REL_LINE, SwFPos::REL_LINE, LB::VertLine, text::RelOrientation::TEXT_LINE}
180 };
181 
182 static RelationMap const aAsCharRelationMap[] =
183 {
184  {SwFPos::REL_BASE, SwFPos::REL_BASE, LB::RelBase, text::RelOrientation::FRAME},
185  {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB::RelChar, text::RelOrientation::FRAME},
186  {SwFPos::REL_ROW, SwFPos::REL_ROW, LB::RelRow, text::RelOrientation::FRAME}
187 };
188 
189 // site anchored
190 static constexpr auto HORI_PAGE_REL = LB::RelPageFrame | LB::RelPagePrintArea | LB::RelPageLeft |
191  LB::RelPageRight;
192 
193 static FrameMap const aHPageMap[] =
194 {
195  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PAGE_REL},
196  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PAGE_REL},
197  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PAGE_REL},
198  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PAGE_REL}
199 };
200 
201 static FrameMap const aHPageHtmlMap[] =
202 {
203  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::RelPageFrame}
204 };
205 
206 #define VERT_PAGE_REL (LB::RelPageFrame|LB::RelPagePrintArea)
207 
208 static FrameMap const aVPageMap[] =
209 {
210  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PAGE_REL},
211  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PAGE_REL},
212  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PAGE_REL},
213  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PAGE_REL}
214 };
215 
216 static FrameMap const aVPageHtmlMap[] =
217 {
218  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB::RelPageFrame}
219 };
220 
221 // frame anchored
222 static constexpr auto HORI_FRAME_REL = LB::FlyRelPageFrame | LB::FlyRelPagePrintArea |
223  LB::FlyRelPageLeft | LB::FlyRelPageRight;
224 
225 static FrameMap const aHFrameMap[] =
226 {
227  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_FRAME_REL},
228  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_FRAME_REL},
229  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_FRAME_REL},
230  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_FRAME_REL}
231 };
232 
233 static FrameMap const aHFlyHtmlMap[] =
234 {
235  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB::FlyRelPageFrame},
236  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::FlyRelPageFrame}
237 };
238 
239 // own vertical alignment map for objects anchored to frame
240 #define VERT_FRAME_REL (LB::FlyVertFrame|LB::FlyVertPrintArea)
241 
242 static FrameMap const aVFrameMap[] =
243 {
244  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_FRAME_REL},
245  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_FRAME_REL},
246  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_FRAME_REL},
247  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_FRAME_REL}
248 };
249 
250 static FrameMap const aVFlyHtmlMap[] =
251 {
252  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::FlyVertFrame},
253  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB::FlyVertFrame}
254 };
255 
256 // paragraph anchored
257 static constexpr auto HORI_PARA_REL = LB::Frame | LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
258  LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
259  LB::RelFrameRight;
260 
261 static FrameMap const aHParaMap[] =
262 {
263  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PARA_REL},
264  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PARA_REL},
265  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PARA_REL},
266  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PARA_REL}
267 };
268 
269 #define HTML_HORI_PARA_REL (LB::Frame|LB::PrintArea)
270 
271 static FrameMap const aHParaHtmlMap[] =
272 {
273  {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
274  {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
275 };
276 
277 static FrameMap const aHParaHtmlAbsMap[] =
278 {
279  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
280  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
281 };
282 
283 // allow vertical alignment at page areas
284 static constexpr auto VERT_PARA_REL = LB::VertFrame | LB::VertPrintArea |
285  LB::RelPageFrame | LB::RelPagePrintArea;
286 
287 static FrameMap const aVParaMap[] =
288 {
289  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PARA_REL},
290  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PARA_REL},
291  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PARA_REL},
292  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PARA_REL}
293 };
294 
295 static FrameMap const aVParaHtmlMap[] =
296 {
297  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::VertPrintArea}
298 };
299 
300 // anchored relative to the character
301 static constexpr auto HORI_CHAR_REL = LB::Frame|LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
302  LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
303  LB::RelFrameRight | LB::RelChar;
304 
305 static FrameMap const aHCharMap[] =
306 {
307  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_CHAR_REL},
308  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_CHAR_REL},
309  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_CHAR_REL},
310  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_CHAR_REL}
311 };
312 
313 #define HTML_HORI_CHAR_REL (LB::Frame|LB::PrintArea|LB::RelChar)
314 
315 static FrameMap const aHCharHtmlMap[] =
316 {
317  {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_CHAR_REL},
318  {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_CHAR_REL}
319 };
320 
321 static FrameMap const aHCharHtmlAbsMap[] =
322 {
323  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB::PrintArea|LB::RelChar},
324  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, LB::PrintArea},
325  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::RelPageFrame}
326 };
327 
328 // allow vertical alignment at page areas
329 static constexpr auto VERT_CHAR_REL = LB::VertFrame | LB::VertPrintArea |
330  LB::RelPageFrame | LB::RelPagePrintArea;
331 
332 static FrameMap const aVCharMap[] =
333 {
334  // introduce mappings for new vertical alignment at top of line <LB::VertLine>
335  // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
336  // Note: Because of these adjustments the map becomes ambiguous in its values
337  // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
338  // in the methods <SwFramePage::FillRelLB(..)>, <SwFramePage::GetAlignment(..)>
339  // and <SwFramePage::FillPosLB(..)>
340  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_CHAR_REL|LB::RelChar},
341  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_CHAR_REL|LB::RelChar},
342  {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar},
343  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_CHAR_REL|LB::RelChar},
344  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_CHAR_REL},
345  {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB::RelChar|LB::VertLine},
346  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::VertLine},
347  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::VertLine},
348  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::VertLine}
349 };
350 
351 static FrameMap const aVCharHtmlMap[] =
352 {
353  {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar}
354 };
355 
356 static FrameMap const aVCharHtmlAbsMap[] =
357 {
358  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelChar},
359  {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar}
360 };
361 
362 // anchored as character
363 static FrameMap const aVAsCharMap[] =
364 {
365  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelBase},
366  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, LB::RelBase},
367  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB::RelBase},
368 
369  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB::RelChar},
370  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::CHAR_BOTTOM, LB::RelChar},
371  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CHAR_CENTER, LB::RelChar},
372 
373  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::RelRow},
374  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::RelRow},
375  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::RelRow},
376 
377  {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB::RelBase}
378 };
379 
380 static FrameMap const aVAsCharHtmlMap[] =
381 {
382  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelBase},
383  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB::RelBase},
384 
385  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB::RelChar},
386 
387  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::RelRow},
388  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::RelRow},
389  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::RelRow}
390 };
391 
392 const sal_uInt16 SwFramePage::aPageRg[] = {
395  RES_COL, RES_COL,
397  0
398 };
399 const sal_uInt16 SwFrameAddPage::aAddPgRg[] = {
405  0
406 };
407 
408 static size_t lcl_GetFrameMapCount( const FrameMap* pMap)
409 {
410  if ( pMap )
411  {
412  if( pMap == aVParaHtmlMap)
413  return SAL_N_ELEMENTS(aVParaHtmlMap);
414  if( pMap == aVAsCharHtmlMap)
415  return SAL_N_ELEMENTS(aVAsCharHtmlMap);
416  if( pMap == aHParaHtmlMap)
417  return SAL_N_ELEMENTS(aHParaHtmlMap);
418  if( pMap == aHParaHtmlAbsMap)
419  return SAL_N_ELEMENTS(aHParaHtmlAbsMap);
420  if ( pMap == aVPageMap )
421  return SAL_N_ELEMENTS(aVPageMap);
422  if ( pMap == aVPageHtmlMap )
423  return SAL_N_ELEMENTS(aVPageHtmlMap);
424  if ( pMap == aVAsCharMap )
425  return SAL_N_ELEMENTS(aVAsCharMap);
426  if ( pMap == aVParaMap )
427  return SAL_N_ELEMENTS(aVParaMap);
428  if ( pMap == aHParaMap )
429  return SAL_N_ELEMENTS(aHParaMap);
430  if ( pMap == aHFrameMap )
431  return SAL_N_ELEMENTS(aHFrameMap);
432  if ( pMap == aVFrameMap )
433  return SAL_N_ELEMENTS(aVFrameMap);
434  if ( pMap == aHCharMap )
435  return SAL_N_ELEMENTS(aHCharMap);
436  if ( pMap == aHCharHtmlMap )
437  return SAL_N_ELEMENTS(aHCharHtmlMap);
438  if ( pMap == aHCharHtmlAbsMap )
439  return SAL_N_ELEMENTS(aHCharHtmlAbsMap);
440  if ( pMap == aVCharMap )
441  return SAL_N_ELEMENTS(aVCharMap);
442  if ( pMap == aVCharHtmlMap )
443  return SAL_N_ELEMENTS(aVCharHtmlMap);
444  if ( pMap == aVCharHtmlAbsMap )
445  return SAL_N_ELEMENTS(aVCharHtmlAbsMap);
446  if ( pMap == aHPageHtmlMap )
447  return SAL_N_ELEMENTS(aHPageHtmlMap);
448  if ( pMap == aHFlyHtmlMap )
449  return SAL_N_ELEMENTS(aHFlyHtmlMap);
450  if ( pMap == aVFlyHtmlMap )
451  return SAL_N_ELEMENTS(aVFlyHtmlMap);
452  return SAL_N_ELEMENTS(aHPageMap);
453  }
454  return 0;
455 }
456 
458  const std::vector< OUString >& rPrev, const std::vector< OUString >& rThis,
459  const std::vector< OUString >& rNext, const std::vector< OUString >& rRemain)
460 {
461  for(const auto& rItem : rPrev)
462  rBox.append_text(rItem);
463  for(const auto& rItem : rThis)
464  rBox.append_text(rItem);
465  for(const auto& rItem : rNext)
466  rBox.append_text(rItem);
467  rBox.append_separator("");
468  //now insert all strings sorted
469  const auto nStartPos = rBox.get_count();
470 
471  for(const auto& rItem : rPrev)
472  ::InsertStringSorted("", rItem, rBox, nStartPos );
473  for(const auto& rItem : rThis)
474  ::InsertStringSorted("", rItem, rBox, nStartPos );
475  for(const auto& rItem : rNext)
476  ::InsertStringSorted("", rItem, rBox, nStartPos );
477  for(const auto& rItem : rRemain)
478  ::InsertStringSorted("", rItem, rBox, nStartPos );
479 }
480 
481 // --> OD 2009-08-31 #mongolianlayout#
482 // add input parameter
483 static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, bool bVertical, bool bVerticalL2R, bool bRTL)
484 {
485  //special handling of STR_FROMLEFT
486  if ( SwFPos::FROMLEFT == eStringId )
487  {
488  eStringId = bVertical
489  ? ( bRTL
490  ? SwFPos::FROMBOTTOM
491  : SwFPos::FROMTOP )
492  : ( bRTL
493  ? SwFPos::FROMRIGHT
494  : SwFPos::FROMLEFT );
495  return eStringId;
496  }
497  // --> OD 2009-08-31 #mongolianlayout#
498  // special handling of STR_FROMTOP in case of mongolianlayout (vertical left-to-right)
499  if ( SwFPos::FROMTOP == eStringId &&
500  bVertical && bVerticalL2R )
501  {
502  eStringId = SwFPos::FROMLEFT;
503  return eStringId;
504  }
505  if ( bVertical )
506  {
507  //exchange horizontal strings with vertical strings and vice versa
508  static const StringIdPair_Impl aHoriIds[] =
509  {
510  {SwFPos::LEFT, SwFPos::TOP},
511  {SwFPos::RIGHT, SwFPos::BOTTOM},
512  {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT},
513  {SwFPos::FROMTOP, SwFPos::FROMRIGHT},
514  {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP},
515  {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} ,
516  {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP},
517  {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM}
518  };
519  static const StringIdPair_Impl aVertIds[] =
520  {
521  {SwFPos::TOP, SwFPos::RIGHT},
522  {SwFPos::BOTTOM, SwFPos::LEFT },
523  {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI},
524  {SwFPos::FROMTOP, SwFPos::FROMRIGHT },
525  {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
526  {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
527  {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
528  {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
529  };
530  // --> OD 2009-08-31 #monglianlayout#
531  static const StringIdPair_Impl aVertL2RIds[] =
532  {
533  {SwFPos::TOP, SwFPos::LEFT },
534  {SwFPos::BOTTOM, SwFPos::RIGHT },
535  {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI },
536  {SwFPos::FROMTOP, SwFPos::FROMLEFT },
537  {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
538  {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
539  {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
540  {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
541  };
542  for(const StringIdPair_Impl & rHoriId : aHoriIds)
543  {
544  if(rHoriId.eHori == eStringId)
545  {
546  eStringId = rHoriId.eVert;
547  return eStringId;
548  }
549  }
550  for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex)
551  {
552  // --> OD 2009-08-31 #mongolianlayout#
553  if ( !bVerticalL2R )
554  {
555  if(aVertIds[nIndex].eHori == eStringId)
556  {
557  eStringId = aVertIds[nIndex].eVert;
558  break;
559  }
560  }
561  else
562  {
563  if(aVertL2RIds[nIndex].eHori == eStringId)
564  {
565  eStringId = aVertL2RIds[nIndex].eVert;
566  break;
567  }
568  }
569  }
570  }
571  return eStringId;
572 }
573 
574 // helper method in order to determine all possible
575 // listbox relations in a relation map for a given relation
576 static LB lcl_GetLBRelationsForRelations( const sal_Int16 _nRel )
577 {
578  LB nLBRelations = LB::NONE;
579 
580  for (RelationMap const & i : aRelationMap)
581  {
582  if ( i.nRelation == _nRel )
583  {
584  nLBRelations |= i.nLBRelation;
585  }
586  }
587 
588  return nLBRelations;
589 }
590 
591 // helper method on order to determine all possible
592 // listbox relations in a relation map for a given string ID
594  const SvxSwFramePosString::StringId _eStrId,
595  const bool _bUseMirrorStr )
596 {
597  LB nLBRelations = LB::NONE;
598 
599  size_t nRelMapSize = lcl_GetFrameMapCount( _pMap );
600  for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
601  {
602  if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) ||
603  ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) )
604  {
605  nLBRelations |= _pMap[nRelMapPos].nLBRelations;
606  }
607  }
608 
609  return nLBRelations;
610 }
611 
612 // standard frame TabPage
613 namespace
614 {
615  void HandleAutoCB(bool _bChecked, weld::Label& _rFT_man, weld::Label& _rFT_auto, weld::MetricSpinButton& _rPF_Edit)
616  {
617  _rFT_man.set_visible( !_bChecked );
618  _rFT_auto.set_visible( _bChecked );
619  OUString accName = _bChecked ? _rFT_auto.get_label() : _rFT_man.get_label();
620  _rPF_Edit.set_accessible_name(accName);
621  }
622 }
623 
625  : SfxTabPage(pPage, pController, "modules/swriter/ui/frmtypepage.ui", "FrameTypePage", &rSet)
626  , m_bAtHorzPosModified(false)
627  , m_bAtVertPosModified(false)
628  , m_bFormat(false)
629  , m_bNew(true)
630  , m_bNoModifyHdl(true)
631  , m_bIsVerticalFrame(false)
632  , m_bIsVerticalL2R(false)
633  , m_bIsInRightToLeft(false)
634  , m_bHtmlMode(false)
635  , m_nHtmlMode(0)
636  , m_nUpperBorder(0)
637  , m_nLowerBorder(0)
638  , m_fWidthHeightRatio(1.0)
639  , mpToCharContentPos(nullptr)
640  , m_nOldH(text::HoriOrientation::CENTER)
641  , m_nOldHRel(text::RelOrientation::FRAME)
642  , m_nOldV(text::VertOrientation::TOP)
643  , m_nOldVRel(text::RelOrientation::PRINT_AREA)
644  , m_pVMap(nullptr)
645  , m_pHMap(nullptr)
646  , m_bAllowVertPositioning( true )
647  , m_bIsMathOLE(false)
648  , m_bIsMathBaselineAlignment(true)
649  , m_xWidthFT(m_xBuilder->weld_label("widthft"))
650  , m_xWidthAutoFT(m_xBuilder->weld_label("autowidthft"))
651  , m_xRelWidthCB(m_xBuilder->weld_check_button("relwidth"))
652  , m_xRelWidthRelationLB(m_xBuilder->weld_combo_box("relwidthrelation"))
653  , m_xAutoWidthCB(m_xBuilder->weld_check_button("autowidth"))
654  , m_xHeightFT(m_xBuilder->weld_label("heightft"))
655  , m_xHeightAutoFT(m_xBuilder->weld_label("autoheightft"))
656  , m_xRelHeightCB(m_xBuilder->weld_check_button("relheight"))
657  , m_xRelHeightRelationLB(m_xBuilder->weld_combo_box("relheightrelation"))
658  , m_xAutoHeightCB(m_xBuilder->weld_check_button("autoheight"))
659  , m_xFixedRatioCB(m_xBuilder->weld_check_button("ratio"))
660  , m_xRealSizeBT(m_xBuilder->weld_button("origsize"))
661  , m_xAnchorFrame(m_xBuilder->weld_widget("anchorframe"))
662  , m_xAnchorAtPageRB(m_xBuilder->weld_radio_button("topage"))
663  , m_xAnchorAtParaRB(m_xBuilder->weld_radio_button("topara"))
664  , m_xAnchorAtCharRB(m_xBuilder->weld_radio_button("tochar"))
665  , m_xAnchorAsCharRB(m_xBuilder->weld_radio_button("aschar"))
666  , m_xAnchorAtFrameRB(m_xBuilder->weld_radio_button("toframe"))
667  , m_xHorizontalFT(m_xBuilder->weld_label("horiposft"))
668  , m_xHorizontalDLB(m_xBuilder->weld_combo_box("horipos"))
669  , m_xAtHorzPosFT(m_xBuilder->weld_label("horibyft"))
670  , m_xAtHorzPosED(m_xBuilder->weld_metric_spin_button("byhori", FieldUnit::CM))
671  , m_xHoriRelationFT(m_xBuilder->weld_label("horitoft"))
672  , m_xHoriRelationLB(m_xBuilder->weld_combo_box("horianchor"))
673  , m_xMirrorPagesCB(m_xBuilder->weld_check_button("mirror"))
674  , m_xVerticalFT(m_xBuilder->weld_label("vertposft"))
675  , m_xVerticalDLB(m_xBuilder->weld_combo_box("vertpos"))
676  , m_xAtVertPosFT(m_xBuilder->weld_label("vertbyft"))
677  , m_xAtVertPosED(m_xBuilder->weld_metric_spin_button("byvert", FieldUnit::CM))
678  , m_xVertRelationFT(m_xBuilder->weld_label("verttoft"))
679  , m_xVertRelationLB(m_xBuilder->weld_combo_box("vertanchor"))
680  , m_xFollowTextFlowCB(m_xBuilder->weld_check_button("followtextflow"))
681  , m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "preview", m_aExampleWN))
682  , m_xWidthED(new SwPercentField(m_xBuilder->weld_metric_spin_button("width", FieldUnit::CM)))
683  , m_xHeightED(new SwPercentField(m_xBuilder->weld_metric_spin_button("height", FieldUnit::CM)))
684 {
685  const auto nWidthRequest = m_xAtHorzPosED->get_preferred_size().Width();
686  m_xAtHorzPosED->set_size_request(nWidthRequest, -1);
687  m_xAtVertPosED->set_size_request(nWidthRequest, -1);
688 
691 
693 
694  Link<weld::MetricSpinButton&,void> aLk3 = LINK(this, SwFramePage, ModifyHdl);
695  m_xWidthED->connect_value_changed( aLk3 );
696  m_xHeightED->connect_value_changed( aLk3 );
697  m_xAtHorzPosED->connect_value_changed( aLk3 );
698  m_xAtVertPosED->connect_value_changed( aLk3 );
699  m_xFollowTextFlowCB->connect_toggled(LINK(this, SwFramePage, RangeModifyClickHdl));
700 
701  Link<weld::ToggleButton&,void> aLk2 = LINK(this, SwFramePage, AnchorTypeHdl);
702  m_xAnchorAtPageRB->connect_toggled( aLk2 );
703  m_xAnchorAtParaRB->connect_toggled( aLk2 );
704  m_xAnchorAtCharRB->connect_toggled( aLk2 );
705  m_xAnchorAsCharRB->connect_toggled( aLk2 );
706  m_xAnchorAtFrameRB->connect_toggled( aLk2 );
707 
708  m_xHorizontalDLB->connect_changed(LINK(this, SwFramePage, PosHdl));
709  m_xVerticalDLB->connect_changed(LINK(this, SwFramePage, PosHdl));
710 
711  m_xHoriRelationLB->connect_changed(LINK(this, SwFramePage, RelHdl));
712  m_xVertRelationLB->connect_changed(LINK(this, SwFramePage, RelHdl));
713 
714  m_xMirrorPagesCB->connect_toggled(LINK(this, SwFramePage, MirrorHdl));
715 
716  aLk2 = LINK(this, SwFramePage, RelSizeClickHdl);
717  m_xRelWidthCB->connect_toggled(aLk2);
718  m_xRelHeightCB->connect_toggled(aLk2);
719 
720  m_xAutoWidthCB->connect_toggled(LINK(this, SwFramePage, AutoWidthClickHdl));
721  m_xAutoHeightCB->connect_toggled(LINK(this, SwFramePage, AutoHeightClickHdl));
722 
724  {
725  m_xAnchorAtPageRB->hide();
726  m_xAnchorAtParaRB->hide();
727  m_xAnchorAtFrameRB->hide();
728  }
729 }
730 
732 {
733 }
734 
735 namespace
736 {
737  struct FrameMaps
738  {
739  FrameMap const * pMap;
740  size_t nCount;
741  };
742 }
743 
745 {
746  static FrameMaps const aMaps[] = {
747  { aHPageMap, SAL_N_ELEMENTS(aHPageMap) },
748  { aHPageHtmlMap, SAL_N_ELEMENTS(aHPageHtmlMap) },
749  { aVPageMap, SAL_N_ELEMENTS(aVPageMap) },
750  { aVPageHtmlMap, SAL_N_ELEMENTS(aVPageHtmlMap) },
751  { aHFrameMap, SAL_N_ELEMENTS(aHFrameMap) },
752  { aHFlyHtmlMap, SAL_N_ELEMENTS(aHFlyHtmlMap) },
753  { aVFrameMap, SAL_N_ELEMENTS(aVFrameMap) },
754  { aVFlyHtmlMap, SAL_N_ELEMENTS(aVFlyHtmlMap) },
755  { aHParaMap, SAL_N_ELEMENTS(aHParaMap) },
756  { aHParaHtmlMap, SAL_N_ELEMENTS(aHParaHtmlMap) },
757  { aHParaHtmlAbsMap, SAL_N_ELEMENTS(aHParaHtmlAbsMap) },
758  { aVParaMap, SAL_N_ELEMENTS(aVParaMap) },
759  { aVParaHtmlMap, SAL_N_ELEMENTS(aVParaHtmlMap) },
760  { aHCharMap, SAL_N_ELEMENTS(aHCharMap) },
761  { aHCharHtmlMap, SAL_N_ELEMENTS(aHCharHtmlMap) },
762  { aHCharHtmlAbsMap, SAL_N_ELEMENTS(aHCharHtmlAbsMap) },
763  { aVCharMap, SAL_N_ELEMENTS(aVCharMap) },
764  { aVCharHtmlMap, SAL_N_ELEMENTS(aVCharHtmlMap) },
765  { aVCharHtmlAbsMap, SAL_N_ELEMENTS(aVCharHtmlAbsMap) },
766  { aVAsCharMap, SAL_N_ELEMENTS(aVAsCharMap) },
767  { aVAsCharHtmlMap, SAL_N_ELEMENTS(aVAsCharHtmlMap) }
768  };
769 
770  std::vector<SvxSwFramePosString::StringId> aFrames;
771  for (const FrameMaps & rMap : aMaps)
772  {
773  for (size_t j = 0; j < rMap.nCount; ++j)
774  {
775  aFrames.push_back(rMap.pMap[j].eStrId);
776  aFrames.push_back(rMap.pMap[j].eMirrorStrId);
777  }
778  }
779 
780  std::sort(aFrames.begin(), aFrames.end());
781  aFrames.erase(std::unique(aFrames.begin(), aFrames.end()), aFrames.end());
782 
783  for (const auto& rFrame : aFrames)
784  {
785  m_xHorizontalDLB->append_text(SvxSwFramePosString::GetString(rFrame));
786  }
787 
788  Size aBiggest(m_xHorizontalDLB->get_preferred_size());
789  m_xHorizontalDLB->set_size_request(aBiggest.Width(), -1);
790  m_xVerticalDLB->set_size_request(aBiggest.Width(), -1);
791  m_xHorizontalDLB->clear();
792 }
793 
794 namespace
795 {
796  struct RelationMaps
797  {
798  RelationMap const * pMap;
799  size_t nCount;
800  };
801 }
802 
804 {
805  static const RelationMaps aMaps[] = {
806  { aRelationMap, SAL_N_ELEMENTS(aRelationMap) },
807  { aAsCharRelationMap, SAL_N_ELEMENTS(aAsCharRelationMap) }
808  };
809 
810  std::vector<SvxSwFramePosString::StringId> aRels;
811  for (const RelationMaps & rMap : aMaps)
812  {
813  for (size_t j = 0; j < rMap.nCount; ++j)
814  {
815  aRels.push_back(rMap.pMap[j].eStrId);
816  aRels.push_back(rMap.pMap[j].eMirrorStrId);
817  }
818  }
819 
820  std::sort(aRels.begin(), aRels.end());
821  aRels.erase(std::unique(aRels.begin(), aRels.end()), aRels.end());
822 
823  for (const auto& rRel : aRels)
824  {
826  }
827 
828  Size aBiggest(m_xHoriRelationLB->get_preferred_size());
829  m_xHoriRelationLB->set_size_request(aBiggest.Width(), -1);
830  m_xVertRelationLB->set_size_request(aBiggest.Width(), -1);
831  m_xRelWidthRelationLB->set_size_request(aBiggest.Width(), -1);
832  m_xRelHeightRelationLB->set_size_request(aBiggest.Width(), -1);
833  m_xHoriRelationLB->clear();
834 }
835 
836 std::unique_ptr<SfxTabPage> SwFramePage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
837 {
838  return std::make_unique<SwFramePage>(pPage, pController, *rSet);
839 }
840 
842 {
843  // i#39692 - mustn't be called more than once
844  if (!m_xRealSizeBT->get_visible())
845  {
846  m_xWidthFT->show();
847  m_xWidthAutoFT->hide();
848  m_xAutoHeightCB->hide();
849 
850  m_xHeightFT->show();
851  m_xHeightAutoFT->hide();
852  m_xAutoWidthCB->hide();
853 
854  m_xRealSizeBT->show();
855  }
856 }
857 
859 {
860  return static_cast<SwFrameDlg*>(GetDialogController())->GetWrtShell();
861 }
862 
863 void SwFramePage::Reset( const SfxItemSet *rSet )
864 {
867 
870 
871  FieldUnit aMetric = ::GetDfltMetric(m_bHtmlMode);
872  m_xWidthED->SetMetric(aMetric);
873  m_xHeightED->SetMetric(aMetric);
874  ::SetFieldUnit(*m_xAtHorzPosED, aMetric);
875  ::SetFieldUnit(*m_xAtVertPosED, aMetric);
876 
877  const SfxPoolItem* pItem = nullptr;
878  const SwFormatAnchor& rAnchor = rSet->Get(RES_ANCHOR);
879 
880  if (SfxItemState::SET == rSet->GetItemState(FN_OLE_IS_MATH, false, &pItem))
881  m_bIsMathOLE = static_cast<const SfxBoolItem*>(pItem)->GetValue();
882  if (SfxItemState::SET == rSet->GetItemState(FN_MATH_BASELINE_ALIGNMENT, false, &pItem))
883  m_bIsMathBaselineAlignment = static_cast<const SfxBoolItem*>(pItem)->GetValue();
885  && RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) );
886 
887  if (m_bFormat)
888  {
889  // at formats no anchor editing
890  m_xAnchorFrame->set_sensitive(false);
891  m_xFixedRatioCB->set_sensitive(false);
892  }
893  else
894  {
895  if (rAnchor.GetAnchorId() != RndStdIds::FLY_AT_FLY && !pSh->IsFlyInFly())
896  m_xAnchorAtFrameRB->hide();
898  {
899  OUString sHLabel = m_xHorizontalFT->get_label();
900  m_xHorizontalFT->set_label(m_xVerticalFT->get_label());
901  m_xVerticalFT->set_label(sHLabel);
902  m_bIsVerticalFrame = true;
903  }
904  }
905 
906  if ( m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog" )
907  {
908  OSL_ENSURE(pSh , "shell not found");
909  //OS: only for the variant Insert/Graphic/Properties
910  if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_GRF_REALSIZE, false, &pItem))
911  m_aGrfSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
912  else
913  pSh->GetGrfSize( m_aGrfSize );
914 
915  if ( !m_bNew )
916  {
917  m_xRealSizeBT->connect_clicked(LINK(this, SwFramePage, RealSizeHdl));
919  }
920 
921  if (m_sDlgType == "PictureDialog")
922  m_xFixedRatioCB->set_active(false);
923  else
924  {
925  if ( m_bNew )
926  SetPageTitle(SwResId(STR_FRMUI_OLE_INSERT));
927  else
928  SetPageTitle(SwResId(STR_FRMUI_OLE_EDIT));
929  }
930  }
931  else
932  {
933  m_aGrfSize = rSet->Get(RES_FRM_SIZE).GetSize();
934  }
935 
936  // entering percent value made possible
937 
938  // the available space is not yet known so the RefValue has to be calculated from size and relative size values
939  // this is needed only if relative values are already set
940  const SwFormatFrameSize& rFrameSize = rSet->Get(RES_FRM_SIZE);
941 
942  m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME));
943  m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME));
944  if (rFrameSize.GetWidthPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetWidthPercent() != 0)
945  {
946  //calculate the reference value from the width and relative width values
947  sal_Int32 nSpace = rFrameSize.GetWidth() * 100 / rFrameSize.GetWidthPercent();
948  m_xWidthED->SetRefValue( nSpace );
949 
950  m_xRelWidthRelationLB->set_sensitive(true);
951  }
952  else
953  m_xRelWidthRelationLB->set_sensitive(false);
954 
955  m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME));
956  m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME));
957  if (rFrameSize.GetHeightPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetHeightPercent() != 0)
958  {
959  //calculate the reference value from the with and relative width values
960  sal_Int32 nSpace = rFrameSize.GetHeight() * 100 / rFrameSize.GetHeightPercent();
961  m_xHeightED->SetRefValue( nSpace );
962 
963  m_xRelHeightRelationLB->set_sensitive(true);
964  }
965  else
966  m_xRelHeightRelationLB->set_sensitive(false);
967 
968  // general initialisation part
969  switch(rAnchor.GetAnchorId())
970  {
971  case RndStdIds::FLY_AT_PAGE: m_xAnchorAtPageRB->set_active(true); break;
972  case RndStdIds::FLY_AT_PARA: m_xAnchorAtParaRB->set_active(true); break;
973  case RndStdIds::FLY_AT_CHAR: m_xAnchorAtCharRB->set_active(true); break;
974  case RndStdIds::FLY_AS_CHAR: m_xAnchorAsCharRB->set_active(true); break;
975  case RndStdIds::FLY_AT_FLY: m_xAnchorAtFrameRB->set_active(true);break;
976  default:; //prevent warning
977  }
978 
979  // i#22341 - determine content position of character
980  // Note: content position can be NULL
982 
983  // i#18732 - init checkbox value
984  {
985  const bool bFollowTextFlow =
986  rSet->Get(RES_FOLLOW_TEXT_FLOW).GetValue();
987  m_xFollowTextFlowCB->set_active(bFollowTextFlow);
988  }
989 
990  if(m_bHtmlMode)
991  {
992  m_xAutoHeightCB->set_sensitive(false);
993  m_xAutoWidthCB->set_sensitive(false);
994  m_xMirrorPagesCB->hide();
995  if (m_sDlgType == "FrameDialog")
996  m_xFixedRatioCB->set_sensitive(false);
997  // i#18732 hide checkbox in HTML mode
998  m_xFollowTextFlowCB->hide();
999  }
1000  else
1001  {
1002  // enable/disable of check box 'Mirror on..'
1003  m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active());
1004 
1005  // enable/disable check box 'Follow text flow'.
1006  // enable check box 'Follow text
1007  // flow' also for anchor type to-frame.
1008  m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() ||
1009  m_xAnchorAtCharRB->get_active() ||
1010  m_xAnchorAtFrameRB->get_active());
1011  }
1012 
1013  Init(*rSet);
1014  m_xAtVertPosED->save_value();
1015  m_xAtHorzPosED->save_value();
1016  m_xFollowTextFlowCB->save_state();
1017 
1018  m_xWidthED->save_value();
1019  m_xHeightED->save_value();
1020 
1021  m_bNoModifyHdl = false;
1022  //lock PercentFields
1023  m_xWidthED->LockAutoCalculation(true);
1024  m_xHeightED->LockAutoCalculation(true);
1025  RangeModifyHdl(); // set all maximum values initially
1026  m_xHeightED->LockAutoCalculation(false);
1027  m_xWidthED->LockAutoCalculation(false);
1028 
1029  m_xAutoHeightCB->save_state();
1030  m_xAutoWidthCB->save_state();
1031 
1032  SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
1033  SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
1034  m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
1035 }
1036 
1037 // stuff attributes into the set when OK
1039 {
1040  bool bRet = false;
1043  OSL_ENSURE( pSh , "shell not found");
1044  const SfxItemSet& rOldSet = GetItemSet();
1045  const SfxPoolItem* pOldItem = nullptr;
1046 
1047  RndStdIds eAnchorId = GetAnchor();
1048 
1049  if ( !m_bFormat )
1050  {
1051  pOldItem = GetOldItem(*rSet, RES_ANCHOR);
1052  if (m_bNew || !pOldItem || eAnchorId != static_cast<const SwFormatAnchor*>(pOldItem)->GetAnchorId())
1053  {
1054  SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1055  bRet = nullptr != rSet->Put( aAnc );
1056  }
1057  }
1058 
1059  if ( m_pHMap )
1060  {
1061  SwFormatHoriOrient aHoriOrient( rOldSet.Get(RES_HORI_ORIENT) );
1062 
1063  const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
1064  const sal_Int16 eHOri = GetAlignment(m_pHMap, nMapPos, *m_xHoriRelationLB);
1065  const sal_Int16 eRel = GetRelation(*m_xHoriRelationLB);
1066 
1067  aHoriOrient.SetHoriOrient( eHOri );
1068  aHoriOrient.SetRelationOrient( eRel );
1069  aHoriOrient.SetPosToggle(m_xMirrorPagesCB->get_active());
1070 
1071  bool bMod = m_xAtHorzPosED->get_value_changed_from_saved();
1072  bMod |= m_xMirrorPagesCB->get_state_changed_from_saved();
1073 
1074  if ( eHOri == text::HoriOrientation::NONE &&
1075  (m_bNew || (m_bAtHorzPosModified || bMod) || m_nOldH != eHOri ) )
1076  {
1077  SwTwips nX = static_cast< SwTwips >(m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)));
1078  aHoriOrient.SetPos( nX );
1079  }
1080 
1081  pOldItem = GetOldItem(*rSet, FN_HORI_ORIENT);
1082  bool bSame = false;
1083  if ((m_bNew == m_bFormat) && pOldItem)
1084  {
1085  bSame = aHoriOrient == static_cast<const SwFormatHoriOrient&>(*pOldItem);
1086  }
1087  if ((m_bNew && !m_bFormat) || ((m_bAtHorzPosModified || bMod) && !bSame))
1088  {
1089  bRet |= nullptr != rSet->Put( aHoriOrient );
1090  }
1091  }
1092 
1093  if ( m_pVMap )
1094  {
1095  // alignment vertical
1096  SwFormatVertOrient aVertOrient( rOldSet.Get(RES_VERT_ORIENT) );
1097 
1098  const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
1099  const sal_Int16 eVOri = GetAlignment(m_pVMap, nMapPos, *m_xVertRelationLB);
1100  const sal_Int16 eRel = GetRelation(*m_xVertRelationLB);
1101 
1102  aVertOrient.SetVertOrient ( eVOri);
1103  aVertOrient.SetRelationOrient( eRel );
1104 
1105  bool bMod = m_xAtVertPosED->get_value_changed_from_saved();
1106 
1107  if ( eVOri == text::VertOrientation::NONE &&
1108  ( m_bNew || (m_bAtVertPosModified || bMod) || m_nOldV != eVOri) )
1109  {
1110  // vertical position
1111  // recalculate offset for character bound frames
1112  SwTwips nY = static_cast< SwTwips >(m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)));
1113  if (eAnchorId == RndStdIds::FLY_AS_CHAR)
1114  {
1115  nY *= -1;
1116  }
1117  aVertOrient.SetPos( nY );
1118  }
1119  pOldItem = GetOldItem(*rSet, FN_VERT_ORIENT);
1120  bool bSame = false;
1121  if((m_bNew == m_bFormat) && pOldItem)
1122  {
1123  bSame = m_bFormat ?
1124  aVertOrient.GetVertOrient() == static_cast<const SwFormatVertOrient*>(pOldItem)->GetVertOrient() &&
1125  aVertOrient.GetRelationOrient() == static_cast<const SwFormatVertOrient*>(pOldItem)->GetRelationOrient() &&
1126  aVertOrient.GetPos() == static_cast<const SwFormatVertOrient*>(pOldItem)->GetPos()
1127  : aVertOrient == static_cast<const SwFormatVertOrient&>(*pOldItem);
1128  }
1129  if( ( m_bNew && !m_bFormat ) || ((m_bAtVertPosModified || bMod) && !bSame ))
1130  {
1131  bRet |= nullptr != rSet->Put( aVertOrient );
1132  }
1133  }
1134 
1135  // set size
1136  // new exception: when the size of pMgr(, 0), then the properties
1137  // for a graphic that isn't even loaded, are set. Then no SetSize
1138  // is done here when the size settings were not changed by the
1139  // user.
1140  const SwFormatFrameSize& rOldSize = rOldSet.Get(RES_FRM_SIZE);
1141  SwFormatFrameSize aSz( rOldSize );
1142 
1143  auto nRelWidthRelation = m_xRelWidthRelationLB->get_active();
1144  if (nRelWidthRelation != -1)
1145  {
1146  if (nRelWidthRelation == 0)
1147  aSz.SetWidthPercentRelation(text::RelOrientation::FRAME);
1148  else if (nRelWidthRelation == 1)
1149  aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME);
1150  }
1151  auto nRelHeightRelation = m_xRelHeightRelationLB->get_active();
1152  if (nRelHeightRelation != -1)
1153  {
1154  if (nRelHeightRelation == 0)
1155  aSz.SetHeightPercentRelation(text::RelOrientation::FRAME);
1156  else if (nRelHeightRelation == 1)
1157  aSz.SetHeightPercentRelation(text::RelOrientation::PAGE_FRAME);
1158  }
1159 
1160  bool bValueModified = m_xWidthED->get_value_changed_from_saved() ||
1161  m_xHeightED->get_value_changed_from_saved();
1162  bool bCheckChanged = m_xRelWidthCB->get_state_changed_from_saved() ||
1163  m_xRelHeightCB->get_state_changed_from_saved();
1164 
1165  bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() &&
1166  m_xWidthED->get_value() == m_xWidthED->get_min() &&
1167  m_xHeightED->get_value() == m_xHeightED->get_min());
1168 
1169  if ((m_bNew && !m_bFormat) || ((bValueModified || bCheckChanged) && bLegalValue))
1170  {
1171  sal_Int64 nNewWidth = m_xWidthED->DenormalizePercent(m_xWidthED->GetRealValue(FieldUnit::TWIP));
1172  sal_Int64 nNewHeight = m_xHeightED->DenormalizePercent(m_xHeightED->GetRealValue(FieldUnit::TWIP));
1173  aSz.SetWidth (static_cast< SwTwips >(nNewWidth));
1174  aSz.SetHeight(static_cast< SwTwips >(nNewHeight));
1175 
1176  if (m_xRelWidthCB->get_active())
1177  {
1178  aSz.SetWidthPercent(static_cast<sal_uInt8>(std::min(MAX_PERCENT_WIDTH, m_xWidthED->Convert(m_xWidthED->NormalizePercent(nNewWidth), FieldUnit::TWIP, FieldUnit::PERCENT))));
1179  }
1180  else
1181  aSz.SetWidthPercent(0);
1182  if (m_xRelHeightCB->get_active())
1183  aSz.SetHeightPercent(static_cast<sal_uInt8>(std::min(MAX_PERCENT_HEIGHT, m_xHeightED->Convert(m_xHeightED->NormalizePercent(nNewHeight), FieldUnit::TWIP, FieldUnit::PERCENT))));
1184  else
1185  aSz.SetHeightPercent(0);
1186 
1187  if (m_xFixedRatioCB->get_active() && (m_xRelWidthCB->get_active() != m_xRelHeightCB->get_active()))
1188  {
1189  if (m_xRelWidthCB->get_active())
1191  else
1193  }
1194  }
1195  if( !IsInGraficMode() )
1196  {
1197  if (m_xAutoHeightCB->get_state_changed_from_saved())
1198  {
1200  if( eFrameSize != aSz.GetHeightSizeType() )
1201  aSz.SetHeightSizeType(eFrameSize);
1202  }
1203  if (m_xAutoWidthCB->get_state_changed_from_saved())
1204  {
1205  SwFrameSize eFrameSize = m_xAutoWidthCB->get_active()? SwFrameSize::Minimum : SwFrameSize::Fixed;
1206  if( eFrameSize != aSz.GetWidthSizeType() )
1207  aSz.SetWidthSizeType( eFrameSize );
1208  }
1209  }
1210  if (!m_bFormat && m_xFixedRatioCB->get_state_changed_from_saved())
1211  bRet |= nullptr != rSet->Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, m_xFixedRatioCB->get_active()));
1212 
1213  pOldItem = GetOldItem(*rSet, RES_FRM_SIZE);
1214 
1215  if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !m_bFormat) ||
1216  (m_bFormat &&
1217  (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
1218  (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))
1219  {
1220  if (aSz.GetHeightSizeType() == SwFrameSize::Variable) // there is no VAR_SIZE in frames
1222 
1223  bRet |= nullptr != rSet->Put( aSz );
1224  }
1225  if (m_xFollowTextFlowCB->get_state_changed_from_saved())
1226  {
1227  bRet |= nullptr != rSet->Put(SwFormatFollowTextFlow(m_xFollowTextFlowCB->get_active()));
1228  }
1229  return bRet;
1230 }
1231 
1232 // initialise horizontal and vertical Pos
1234  sal_Int16 nH,
1235  sal_Int16 nHRel,
1236  sal_Int16 nV,
1237  sal_Int16 nVRel,
1238  long nX,
1239  long nY)
1240 {
1241  auto nPos = m_xVerticalDLB->get_active();
1242  if (nPos != -1 && m_pVMap)
1243  {
1245 
1246  nPos = m_xVertRelationLB->get_active();
1247  if (nPos != -1)
1248  m_nOldVRel = reinterpret_cast<RelationMap*>(m_xVertRelationLB->get_id(nPos).toInt64())->nRelation;
1249  }
1250 
1251  nPos = m_xHorizontalDLB->get_active();
1252  if (nPos != -1 && m_pHMap)
1253  {
1255 
1256  nPos = m_xHoriRelationLB->get_active();
1257  if (nPos != -1)
1258  m_nOldHRel = reinterpret_cast<RelationMap*>(m_xHoriRelationLB->get_id(nPos).toInt64())->nRelation;
1259  }
1260 
1261  bool bEnable = true;
1262  if ( eId == RndStdIds::FLY_AT_PAGE )
1263  {
1264  m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap;
1265  m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap;
1266  }
1267  else if ( eId == RndStdIds::FLY_AT_FLY )
1268  {
1269  // own vertical alignment map for to frame
1270  // anchored objects.
1271  m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
1272  m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
1273  }
1274  else if ( eId == RndStdIds::FLY_AT_PARA )
1275  {
1276  if(m_bHtmlMode)
1277  {
1280  }
1281  else
1282  {
1283  m_pVMap = aVParaMap;
1284  m_pHMap = aHParaMap;
1285  }
1286  }
1287  else if ( eId == RndStdIds::FLY_AT_CHAR )
1288  {
1289  if(m_bHtmlMode)
1290  {
1293  }
1294  else
1295  {
1296  m_pVMap = aVCharMap;
1297  m_pHMap = aHCharMap;
1298  }
1299  }
1300  else if ( eId == RndStdIds::FLY_AS_CHAR )
1301  {
1302  m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap;
1303  m_pHMap = nullptr;
1304  bEnable = false;
1305  }
1306  m_xHorizontalDLB->set_sensitive( bEnable );
1307  m_xHorizontalFT->set_sensitive( bEnable );
1308 
1309  // select current Pos
1310  // horizontal
1311  if ( nH < 0 )
1312  {
1313  nH = m_nOldH;
1314  nHRel = m_nOldHRel;
1315  }
1316  sal_Int32 nMapPos = FillPosLB(m_pHMap, nH, nHRel, *m_xHorizontalDLB);
1317  FillRelLB(m_pHMap, nMapPos, nH, nHRel, *m_xHoriRelationLB, *m_xHoriRelationFT);
1318 
1319  // vertical
1320  if ( nV < 0 )
1321  {
1322  nV = m_nOldV;
1323  nVRel = m_nOldVRel;
1324  }
1325  nMapPos = FillPosLB(m_pVMap, nV, nVRel, *m_xVerticalDLB);
1326  FillRelLB(m_pVMap, nMapPos, nV, nVRel, *m_xVertRelationLB, *m_xVertRelationFT);
1327 
1328  bEnable = nH == text::HoriOrientation::NONE && eId != RndStdIds::FLY_AS_CHAR;
1329  if (!bEnable)
1330  m_xAtHorzPosED->set_value(0, FieldUnit::TWIP);
1331  else
1332  {
1333  if (nX != LONG_MAX)
1334  m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(nX), FieldUnit::TWIP);
1335  }
1336  m_xAtHorzPosFT->set_sensitive( bEnable );
1337  m_xAtHorzPosED->set_sensitive( bEnable );
1338 
1339  bEnable = nV == text::VertOrientation::NONE;
1340  if ( !bEnable )
1341  m_xAtVertPosED->set_value(0, FieldUnit::TWIP);
1342  else
1343  {
1344  if (eId == RndStdIds::FLY_AS_CHAR)
1345  {
1346  if ( nY == LONG_MAX )
1347  nY = 0;
1348  else
1349  nY *= -1;
1350  }
1351  if ( nY != LONG_MAX )
1352  m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(nY), FieldUnit::TWIP);
1353  }
1354  m_xAtVertPosFT->set_sensitive( bEnable && m_bAllowVertPositioning );
1355  m_xAtVertPosED->set_sensitive( bEnable && m_bAllowVertPositioning );
1356  UpdateExample();
1357 }
1358 
1359 sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
1360  const sal_Int16 _nAlign,
1361  const sal_Int16 _nRel,
1362  weld::ComboBox& _rLB )
1363 {
1364  OUString sSelEntry;
1365  const OUString sOldEntry = _rLB.get_active_text();
1366 
1367  _rLB.clear();
1368 
1369  // i#22341 determine all possible listbox relations for
1370  // given relation for map <aVCharMap>
1371  const LB nLBRelations = (_pMap != aVCharMap)
1372  ? LB::NONE
1373  : ::lcl_GetLBRelationsForRelations( _nRel );
1374 
1375  // fill Listbox
1376  size_t nCount = ::lcl_GetFrameMapCount(_pMap);
1377  for (size_t i = 0; _pMap && i < nCount; ++i)
1378  {
1379 // Why not from the left/from inside or from above?
1380  SvxSwFramePosString::StringId eStrId = m_xMirrorPagesCB->get_active() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
1381  // --> OD 2009-08-31 #mongolianlayout#
1382  eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
1386  OUString sEntry(SvxSwFramePosString::GetString(eStrId));
1387  if (_rLB.find_text(sEntry) == -1)
1388  {
1389  // don't insert entries when frames are character bound
1390  _rLB.append_text(sEntry);
1391  }
1392  // i#22341 - add condition to handle map <aVCharMap>
1393  // that is ambiguous in the alignment.
1394  if ( _pMap[i].nAlign == _nAlign &&
1395  ( (_pMap != aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
1396  {
1397  sSelEntry = sEntry;
1398  }
1399  }
1400 
1401  _rLB.set_active_text(sSelEntry);
1402  if (_rLB.get_active() == -1)
1403  _rLB.set_active_text(sOldEntry);
1404 
1405  if (_rLB.get_active() == -1)
1406  _rLB.set_active(0);
1407 
1408  PosHdl(_rLB);
1409 
1410  return GetMapPos(_pMap, _rLB);
1411 }
1412 
1414  const sal_uInt16 _nLBSelPos,
1415  const sal_Int16 _nAlign,
1416  const sal_Int16 _nRel,
1417  weld::ComboBox& _rLB,
1418  weld::Label& _rFT)
1419 {
1420  OUString sSelEntry;
1421  LB nLBRelations = LB::NONE;
1422  size_t nMapCount = ::lcl_GetFrameMapCount(_pMap);
1423 
1424  _rLB.clear();
1425 
1426  if (_nLBSelPos < nMapCount)
1427  {
1428  if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
1429  {
1430  const OUString sOldEntry(_rLB.get_active_text());
1431  SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
1432 
1433  for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
1434  {
1435  if (_pMap[nMapPos].eStrId == eStrId)
1436  {
1437  nLBRelations = _pMap[nMapPos].nLBRelations;
1438  for (RelationMap const & rCharMap : aAsCharRelationMap)
1439  {
1440  if (nLBRelations & rCharMap.nLBRelation)
1441  {
1442  // --> OD 2009-08-31 #mongolianlayout#
1444  lcl_ChangeResIdToVerticalOrRTL( rCharMap.eStrId,
1448  const OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
1449  _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rCharMap)), sEntry);
1450  if (_pMap[nMapPos].nAlign == _nAlign)
1451  sSelEntry = sEntry;
1452  break;
1453  }
1454  }
1455  }
1456  }
1457  if (!sSelEntry.isEmpty())
1458  _rLB.set_active_text(sSelEntry);
1459  else
1460  {
1461  _rLB.set_active_text(sOldEntry);
1462 
1463  if (_rLB.get_active() == -1)
1464  {
1465  for (int i = 0; i < _rLB.get_count(); i++)
1466  {
1467  RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64());
1468  if (pEntry->nLBRelation == LB::RelChar) // default
1469  {
1470  _rLB.set_active(i);
1471  break;
1472  }
1473  }
1474  }
1475  }
1476  }
1477  else
1478  {
1479  // special handling for map <aVCharMap>,
1480  // because its ambiguous in its <eStrId>/<eMirrorStrId>.
1481  if ( _pMap == aVCharMap )
1482  {
1483  nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap,
1484  ( m_xMirrorPagesCB->get_active()
1485  ? _pMap[_nLBSelPos].eMirrorStrId
1486  : _pMap[_nLBSelPos].eStrId),
1487  m_xMirrorPagesCB->get_active() );
1488  }
1489  else
1490  {
1491  nLBRelations = _pMap[_nLBSelPos].nLBRelations;
1492  }
1493 
1494  for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1)
1495  {
1496  if (nLBRelations & static_cast<LB>(nBit))
1497  {
1498  for (RelationMap const & rMap : aRelationMap)
1499  {
1500  if (rMap.nLBRelation == static_cast<LB>(nBit))
1501  {
1502  SvxSwFramePosString::StringId eStrId1 = m_xMirrorPagesCB->get_active() ?
1503  rMap.eMirrorStrId : rMap.eStrId;
1504  // --> OD 2009-08-31 #mongolianlayout#
1505  eStrId1 =
1510  const OUString sEntry = SvxSwFramePosString::GetString(eStrId1);
1511  _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rMap)), sEntry);
1512  if (sSelEntry.isEmpty() && rMap.nRelation == _nRel)
1513  sSelEntry = sEntry;
1514  }
1515  }
1516  }
1517  }
1518  if (!sSelEntry.isEmpty())
1519  _rLB.set_active_text(sSelEntry);
1520  else
1521  {
1522  // Probably anchor switch. So look for similar relation
1523  sal_Int16 nSimRel = -1;
1524  switch (_nRel)
1525  {
1526  case text::RelOrientation::FRAME:
1527  nSimRel = text::RelOrientation::PAGE_FRAME;
1528  break;
1529  case text::RelOrientation::PRINT_AREA:
1530  nSimRel = text::RelOrientation::PAGE_PRINT_AREA;
1531  break;
1532  case text::RelOrientation::PAGE_LEFT:
1533  nSimRel = text::RelOrientation::FRAME_LEFT;
1534  break;
1535  case text::RelOrientation::PAGE_RIGHT:
1536  nSimRel = text::RelOrientation::FRAME_RIGHT;
1537  break;
1538  case text::RelOrientation::FRAME_LEFT:
1539  nSimRel = text::RelOrientation::PAGE_LEFT;
1540  break;
1541  case text::RelOrientation::FRAME_RIGHT:
1542  nSimRel = text::RelOrientation::PAGE_RIGHT;
1543  break;
1544  case text::RelOrientation::PAGE_FRAME:
1545  nSimRel = text::RelOrientation::FRAME;
1546  break;
1547  case text::RelOrientation::PAGE_PRINT_AREA:
1548  nSimRel = text::RelOrientation::PRINT_AREA;
1549  break;
1550 
1551  default:
1552  if (_rLB.get_active() != -1)
1553  {
1554  RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(_rLB.get_count() - 1).toInt64());
1555  nSimRel = pEntry->nRelation;
1556  }
1557  break;
1558  }
1559 
1560  for (int i = 0; i < _rLB.get_count(); i++)
1561  {
1562  RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64());
1563  if (pEntry->nRelation == nSimRel)
1564  {
1565  _rLB.set_active(i);
1566  break;
1567  }
1568  }
1569 
1570  if (_rLB.get_active() == -1)
1571  _rLB.set_active(0);
1572  }
1573  }
1574  }
1575 
1576  const bool bEnable = _rLB.get_count() != 0
1577  && (&_rLB != m_xVertRelationLB.get() || m_bAllowVertPositioning);
1578  _rLB.set_sensitive( bEnable );
1579  _rFT.set_sensitive( bEnable );
1580 
1581  RelHdl(_rLB);
1582 }
1583 
1584 sal_Int16 SwFramePage::GetRelation(const weld::ComboBox& rRelationLB)
1585 {
1586  const auto nPos = rRelationLB.get_active();
1587  if (nPos != -1)
1588  {
1589  RelationMap *pEntry = reinterpret_cast<RelationMap *>(rRelationLB.get_id(nPos).toInt64());
1590  return pEntry->nRelation;
1591  }
1592 
1593  return 0;
1594 }
1595 
1596 sal_Int16 SwFramePage::GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos,
1597  const weld::ComboBox& rRelationLB)
1598 {
1599  if (!pMap || nMapPos < 0)
1600  return 0;
1601 
1602  const size_t nMapCount = ::lcl_GetFrameMapCount(pMap);
1603 
1604  if (static_cast<size_t>(nMapPos) >= nMapCount)
1605  return 0;
1606 
1607  // i#22341 special handling also for map <aVCharMap>,
1608  // because it contains ambiguous items for alignment
1609  if ( pMap != aVAsCharHtmlMap && pMap != aVAsCharMap && pMap != aVCharMap )
1610  return pMap[nMapPos].nAlign;
1611 
1612  if (rRelationLB.get_active() == -1)
1613  return 0;
1614 
1615  const RelationMap *const pRelationMap = reinterpret_cast<const RelationMap *>(
1616  rRelationLB.get_active_id().toInt64());
1617  const LB nRel = pRelationMap->nLBRelation;
1618  const SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
1619 
1620  for (size_t i = 0; i < nMapCount; ++i)
1621  {
1622  if (pMap[i].eStrId == eStrId && (pMap[i].nLBRelations & nRel))
1623  return pMap[i].nAlign;
1624  }
1625 
1626  return 0;
1627 }
1628 
1629 sal_Int32 SwFramePage::GetMapPos(const FrameMap *pMap, const weld::ComboBox& rAlignLB)
1630 {
1631  sal_Int32 nMapPos = 0;
1632  auto nLBSelPos = rAlignLB.get_active();
1633 
1634  if (nLBSelPos != -1)
1635  {
1636  if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
1637  {
1638  const size_t nMapCount = ::lcl_GetFrameMapCount(pMap);
1639  const OUString sSelEntry(rAlignLB.get_active_text());
1640 
1641  for (size_t i = 0; i < nMapCount; i++)
1642  {
1643  SvxSwFramePosString::StringId eResId = pMap[i].eStrId;
1644 
1645  OUString sEntry = SvxSwFramePosString::GetString(eResId);
1646  sEntry = MnemonicGenerator::EraseAllMnemonicChars( sEntry );
1647 
1648  if (sEntry == sSelEntry)
1649  {
1650  nMapPos = static_cast< sal_Int32 >(i);
1651  break;
1652  }
1653  }
1654  }
1655  else
1656  nMapPos = nLBSelPos;
1657  }
1658 
1659  return nMapPos;
1660 }
1661 
1663 {
1664  RndStdIds nRet = RndStdIds::FLY_AT_PAGE;
1665  if (m_xAnchorAtParaRB->get_active())
1666  {
1667  nRet = RndStdIds::FLY_AT_PARA;
1668  }
1669  else if (m_xAnchorAtCharRB->get_active())
1670  {
1671  nRet = RndStdIds::FLY_AT_CHAR;
1672  }
1673  else if (m_xAnchorAsCharRB->get_active())
1674  {
1675  nRet = RndStdIds::FLY_AS_CHAR;
1676  }
1677  else if (m_xAnchorAtFrameRB->get_active())
1678  {
1679  nRet = RndStdIds::FLY_AT_FLY;
1680  }
1681  return nRet;
1682 }
1683 
1684 // Bsp - Update
1686 {
1687  m_bNoModifyHdl = true;
1688  Init(rSet);
1689  m_bNoModifyHdl = false;
1690  //lock PercentFields
1691  m_xWidthED->LockAutoCalculation(true);
1692  m_xHeightED->LockAutoCalculation(true);
1693  RangeModifyHdl(); // set all maximum values initially
1694  m_xHeightED->LockAutoCalculation(false);
1695  m_xWidthED->LockAutoCalculation(false);
1696  m_xFollowTextFlowCB->save_state();
1697 }
1698 
1700 {
1701  if ( _pSet )
1702  {
1703  FillItemSet( _pSet );
1704 
1705  if (!m_bFormat) // tdf#112574 no anchor in styles
1706  {
1707  //FillItemSet doesn't set the anchor into the set when it matches
1708  //the original. But for the other pages we need the current anchor.
1711  RndStdIds eAnchorId = GetAnchor();
1712  SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1713  _pSet->Put( aAnc );
1714  }
1715  }
1716 
1717  return DeactivateRC::LeavePage;
1718 }
1719 
1720 // swap left/right with inside/outside
1722 {
1723  RndStdIds eId = GetAnchor();
1724  InitPos(eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
1725 }
1726 
1727 IMPL_LINK( SwFramePage, RelSizeClickHdl, weld::ToggleButton&, rBtn, void )
1728 {
1729  if (&rBtn == m_xRelWidthCB.get())
1730  {
1731  m_xWidthED->ShowPercent(rBtn.get_active());
1732  m_xRelWidthRelationLB->set_sensitive(rBtn.get_active());
1733  if (rBtn.get_active())
1734  m_xWidthED->get()->set_max(MAX_PERCENT_WIDTH, FieldUnit::NONE);
1735  }
1736  else // rBtn == m_xRelHeightCB.get()
1737  {
1738  m_xHeightED->ShowPercent(rBtn.get_active());
1739  m_xRelHeightRelationLB->set_sensitive(rBtn.get_active());
1740  if (rBtn.get_active())
1741  m_xHeightED->get()->set_max(MAX_PERCENT_HEIGHT, FieldUnit::NONE);
1742  }
1743 
1744  RangeModifyHdl(); // correct the values again
1745 
1746  if (&rBtn == m_xRelWidthCB.get())
1747  ModifyHdl(*m_xWidthED->get());
1748  else // rBtn == m_xRelHeightCB.get()
1749  ModifyHdl(*m_xHeightED->get());
1750 }
1751 
1752 // range check
1753 IMPL_LINK_NOARG(SwFramePage, RangeModifyClickHdl, weld::ToggleButton&, void)
1754 {
1755  RangeModifyHdl();
1756 }
1757 
1759 {
1760  if (m_bNoModifyHdl)
1761  return;
1762 
1765  OSL_ENSURE(pSh , "shell not found");
1766  SwFlyFrameAttrMgr aMgr( m_bNew, pSh, GetItemSet() );
1767  SvxSwFrameValidation aVal;
1768 
1769  aVal.nAnchorType = GetAnchor();
1770  aVal.bAutoHeight = m_xAutoHeightCB->get_active();
1771  aVal.bMirror = m_xMirrorPagesCB->get_active();
1772  aVal.bFollowTextFlow = m_xFollowTextFlowCB->get_active();
1773 
1774  if ( m_pHMap )
1775  {
1776  // alignment horizontal
1777  const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
1780  }
1781  else
1783 
1784  if ( m_pVMap )
1785  {
1786  // alignment vertical
1787  const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
1790  }
1791  else
1793 
1794  const long nAtHorzPosVal = static_cast< long >(
1795  m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)) );
1796  const long nAtVertPosVal = static_cast< long >(
1797  m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)) );
1798 
1799  aVal.nHPos = nAtHorzPosVal;
1800  aVal.nVPos = nAtVertPosVal;
1801 
1802  aMgr.ValidateMetrics(aVal, mpToCharContentPos, true); // one time, to get reference values for percental values
1803 
1804  // set reference values for percental values (100%) ...
1805  m_xWidthED->SetRefValue(aVal.aPercentSize.Width());
1806  m_xHeightED->SetRefValue(aVal.aPercentSize.Height());
1807 
1808  // ... and correctly convert width and height with it
1809  SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
1810  SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
1811  aVal.nWidth = nWidth;
1812  aVal.nHeight = nHeight;
1813 
1814  aMgr.ValidateMetrics(aVal, mpToCharContentPos); // one more time, to determine all remaining values with correct width and height.
1815 
1816  // all columns have to be correct
1817  const SfxItemSet* pExampleSet = GetDialogExampleSet();
1818  if (pExampleSet && SfxItemState::DEFAULT <= pExampleSet->GetItemState(RES_COL))
1819  {
1820  const SwFormatCol& rCol = pExampleSet->Get(RES_COL);
1821  if ( rCol.GetColumns().size() > 1 )
1822  {
1823  for (const SwColumn & i : rCol.GetColumns())
1824  {
1825  aVal.nMinWidth += i.GetLeft() +
1826  i.GetRight() +
1827  MINFLY;
1828  }
1829  aVal.nMinWidth -= MINFLY;//one was already in there!
1830  }
1831  }
1832 
1833  nWidth = aVal.nWidth;
1834  nHeight = aVal.nHeight;
1835 
1836  // minimum range also for template
1837  m_xHeightED->set_min(m_xHeightED->NormalizePercent(aVal.nMinHeight), FieldUnit::TWIP);
1838  m_xWidthED->set_min(m_xWidthED->NormalizePercent(aVal.nMinWidth), FieldUnit::TWIP);
1839 
1840  SwTwips nMaxWidth(aVal.nMaxWidth);
1841  SwTwips nMaxHeight(aVal.nMaxHeight);
1842 
1843  if (aVal.bAutoHeight && (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog"))
1844  {
1845  SwTwips nTmp = std::min(nWidth * nMaxHeight / std::max(nHeight, 1L), nMaxHeight);
1846  m_xWidthED->set_max(m_xWidthED->NormalizePercent(nTmp), FieldUnit::TWIP);
1847 
1848  nTmp = std::min(nHeight * nMaxWidth / std::max(nWidth, 1L), nMaxWidth);
1849  m_xHeightED->set_max(m_xWidthED->NormalizePercent(nTmp), FieldUnit::TWIP);
1850  }
1851  else
1852  {
1853  SwTwips nTmp = static_cast< SwTwips >(m_xHeightED->NormalizePercent(nMaxHeight));
1854  m_xHeightED->set_max(nTmp, FieldUnit::TWIP);
1855 
1856  nTmp = static_cast< SwTwips >(m_xWidthED->NormalizePercent(nMaxWidth));
1857  m_xWidthED->set_max(nTmp, FieldUnit::TWIP);
1858  }
1859 
1860  m_xAtHorzPosED->set_range(m_xAtHorzPosED->normalize(aVal.nMinHPos),
1861  m_xAtHorzPosED->normalize(aVal.nMaxHPos),
1862  FieldUnit::TWIP);
1863  if (aVal.nHPos != nAtHorzPosVal)
1864  m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(aVal.nHPos), FieldUnit::TWIP);
1865 
1866  const SwTwips nUpperOffset = (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR)
1867  ? m_nUpperBorder : 0;
1868  const SwTwips nLowerOffset = (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR)
1869  ? m_nLowerBorder : 0;
1870 
1871  m_xAtVertPosED->set_range(m_xAtVertPosED->normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset),
1872  m_xAtVertPosED->normalize(aVal.nMaxVPos),
1873  FieldUnit::TWIP);
1874  if (aVal.nVPos != nAtVertPosVal)
1875  m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(aVal.nVPos), FieldUnit::TWIP);
1876 }
1877 
1879 {
1880  m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active());
1881 
1882  // i#18732 - enable check box 'Follow text flow' for anchor
1883  // type to-paragraph' and to-character
1884  // i#22305 - enable check box 'Follow text
1885  // flow' also for anchor type to-frame.
1886  m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() ||
1887  m_xAnchorAtCharRB->get_active() ||
1888  m_xAnchorAtFrameRB->get_active());
1889 
1890  RndStdIds eId = GetAnchor();
1891 
1892  InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
1893  RangeModifyHdl();
1894 
1895  if(m_bHtmlMode)
1896  {
1897  PosHdl(*m_xHorizontalDLB);
1898  PosHdl(*m_xVerticalDLB);
1899  }
1900 
1901  EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
1902  && RndStdIds::FLY_AS_CHAR == eId) );
1903 }
1904 
1905 IMPL_LINK( SwFramePage, PosHdl, weld::ComboBox&, rLB, void )
1906 {
1907  bool bHori = &rLB == m_xHorizontalDLB.get();
1908  weld::ComboBox *pRelLB = bHori ? m_xHoriRelationLB.get() : m_xVertRelationLB.get();
1909  weld::Label *pRelFT = bHori ? m_xHoriRelationFT.get() : m_xVertRelationFT.get();
1910  FrameMap const *pMap = bHori ? m_pHMap : m_pVMap;
1911 
1912  const sal_Int32 nMapPos = GetMapPos(pMap, rLB);
1913  const sal_Int16 nAlign = GetAlignment(pMap, nMapPos, *pRelLB);
1914 
1915  if (bHori)
1916  {
1917  bool bEnable = text::HoriOrientation::NONE == nAlign;
1918  m_xAtHorzPosED->set_sensitive( bEnable );
1919  m_xAtHorzPosFT->set_sensitive( bEnable );
1920  }
1921  else
1922  {
1923  bool bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning;
1924  m_xAtVertPosED->set_sensitive( bEnable );
1925  m_xAtVertPosFT->set_sensitive( bEnable );
1926  }
1927 
1928  RangeModifyHdl();
1929 
1930  sal_Int16 nRel = 0;
1931  if (rLB.get_active() != -1)
1932  {
1933  if (pRelLB->get_active() != -1)
1934  nRel = reinterpret_cast<RelationMap*>(pRelLB->get_active_id().toInt64())->nRelation;
1935  FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
1936  }
1937  else
1938  pRelLB->clear();
1939 
1940  UpdateExample();
1941 
1942  if (bHori)
1943  m_bAtHorzPosModified = true;
1944  else
1945  m_bAtVertPosModified = true;
1946 
1947  // special treatment for HTML-Mode with horizontal-vertical-dependencies
1948  if(m_bHtmlMode && (RndStdIds::FLY_AT_CHAR == GetAnchor()))
1949  {
1950  bool bSet = false;
1951  if(bHori)
1952  {
1953  // right is allowed only above - from the left only above
1954  // from the left at character -> below
1955  if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
1956  0 == m_xVerticalDLB->get_active())
1957  {
1958  if(text::RelOrientation::FRAME == nRel)
1959  m_xVerticalDLB->set_active(1);
1960  else
1961  m_xVerticalDLB->set_active(0);
1962  bSet = true;
1963  }
1964  else if(text::HoriOrientation::LEFT == nAlign && 1 == m_xVerticalDLB->get_active())
1965  {
1966  m_xVerticalDLB->set_active(0);
1967  bSet = true;
1968  }
1969  else if(text::HoriOrientation::NONE == nAlign && 1 == m_xVerticalDLB->get_active())
1970  {
1971  m_xVerticalDLB->set_active(0);
1972  bSet = true;
1973  }
1974  if(bSet)
1975  PosHdl(*m_xVerticalDLB);
1976  }
1977  else
1978  {
1979  if(text::VertOrientation::TOP == nAlign)
1980  {
1981  if (1 == m_xHorizontalDLB->get_active())
1982  {
1983  m_xHorizontalDLB->set_active(0);
1984  bSet = true;
1985  }
1986  m_xHoriRelationLB->set_active(1);
1987  }
1988  else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
1989  {
1990  if (2 == m_xHorizontalDLB->get_active())
1991  {
1992  m_xHorizontalDLB->set_active(0);
1993  bSet = true;
1994  }
1995  m_xHoriRelationLB->set_active(0) ;
1996  }
1997  if(bSet)
1998  PosHdl(*m_xHorizontalDLB);
1999  }
2000 
2001  }
2002 }
2003 
2004 // horizontal Pos
2005 IMPL_LINK( SwFramePage, RelHdl, weld::ComboBox&, rLB, void )
2006 {
2007  bool bHori = &rLB == m_xHoriRelationLB.get();
2008 
2009  UpdateExample();
2010 
2011  if (bHori)
2012  m_bAtHorzPosModified = true;
2013  else
2014  m_bAtVertPosModified = true;
2015 
2016  if (m_bHtmlMode && (RndStdIds::FLY_AT_CHAR == GetAnchor()))
2017  {
2018  if(bHori)
2019  {
2020  const sal_Int16 nRel = GetRelation(*m_xHoriRelationLB);
2021  if(text::RelOrientation::PRINT_AREA == nRel && 0 == m_xVerticalDLB->get_active())
2022  {
2023  m_xVerticalDLB->set_active(1);
2024  }
2025  else if(text::RelOrientation::CHAR == nRel && 1 == m_xVerticalDLB->get_active())
2026  {
2027  m_xVerticalDLB->set_active(0);
2028  }
2029  }
2030  }
2031  RangeModifyHdl();
2032 }
2033 
2035 {
2036  m_xWidthED->set_value(m_xWidthED->NormalizePercent(m_aGrfSize.Width()), FieldUnit::TWIP);
2037  m_xHeightED->set_value(m_xHeightED->NormalizePercent(m_aGrfSize.Height()), FieldUnit::TWIP);
2038  m_fWidthHeightRatio = m_aGrfSize.Height() ? double(m_aGrfSize.Width()) / double(m_aGrfSize.Height()) : 1.0;
2039  UpdateExample();
2040 }
2041 
2043 {
2044  if( !IsInGraficMode() )
2045  HandleAutoCB( m_xAutoWidthCB->get_active(), *m_xWidthFT, *m_xWidthAutoFT, *m_xWidthED->get() );
2046 }
2047 
2048 IMPL_LINK_NOARG(SwFramePage, AutoHeightClickHdl, weld::ToggleButton&, void)
2049 {
2050  if (!IsInGraficMode())
2051  HandleAutoCB(m_xAutoHeightCB->get_active(), *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get());
2052 }
2053 
2054 IMPL_LINK( SwFramePage, ModifyHdl, weld::MetricSpinButton&, rEdit, void )
2055 {
2056  SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
2057  SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
2058  if (m_xFixedRatioCB->get_active())
2059  {
2060  if (&rEdit == m_xWidthED->get())
2061  {
2062  nHeight = SwTwips(static_cast<double>(nWidth) / m_fWidthHeightRatio);
2063  m_xHeightED->set_value(m_xHeightED->NormalizePercent(nHeight), FieldUnit::TWIP);
2064  }
2065  else if (&rEdit == m_xHeightED->get())
2066  {
2067  nWidth = SwTwips(static_cast<double>(nHeight) * m_fWidthHeightRatio);
2068  m_xWidthED->set_value(m_xWidthED->NormalizePercent(nWidth), FieldUnit::TWIP);
2069  }
2070  }
2071  m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
2072  UpdateExample();
2073 }
2074 
2076 {
2077  auto nPos = m_xHorizontalDLB->get_active();
2078  if (m_pHMap && nPos != -1)
2079  {
2080  const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
2083  }
2084 
2085  nPos = m_xVerticalDLB->get_active();
2086  if (m_pVMap && nPos != -1)
2087  {
2088  const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
2091  }
2092 
2093  // size
2094  auto nXPos = m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP));
2095  auto nYPos = m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP));
2096  m_aExampleWN.SetRelPos(Point(nXPos, nYPos));
2097 
2099  m_aExampleWN.Invalidate();
2100 }
2101 
2103 {
2104  if(!m_bFormat)
2105  {
2107 
2108  // size
2109  const bool bSizeFixed = pSh->IsSelObjProtected( FlyProtectFlags::Fixed ) != FlyProtectFlags::NONE;
2110 
2111  m_xWidthED->set_sensitive( !bSizeFixed );
2112  m_xHeightED->set_sensitive( !bSizeFixed );
2113 
2114  // size controls for math OLE objects
2115  if ( m_sDlgType == "ObjectDialog" && ! m_bNew )
2116  {
2117  // disable width and height for math objects
2118  const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() );
2119 
2120  static struct GlobalNameId {
2121  sal_uInt32 const n1;
2122  sal_uInt16 n2, n3;
2123  sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
2124  } const aGlbNmIds[] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 },
2126 
2127  for (const GlobalNameId & rId : aGlbNmIds) {
2128  SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
2129  rId.b8, rId.b9, rId.b10, rId.b11,
2130  rId.b12, rId.b13, rId.b14, rId.b15 );
2131 
2132  if( rFactNm == aGlbNm )
2133  {
2134  // disable size controls for math OLE objects
2135  m_xWidthFT->set_sensitive(false);
2136  m_xWidthED->set_sensitive(false);
2137  m_xRelWidthCB->set_sensitive(false);
2138  m_xHeightFT->set_sensitive(false);
2139  m_xHeightED->set_sensitive(false);
2140  m_xRelHeightCB->set_sensitive(false);
2141  m_xFixedRatioCB->set_sensitive(false);
2142  m_xRealSizeBT->set_sensitive(false);
2143  break;
2144  }
2145  }
2146 
2147  // TODO/LATER: get correct aspect
2148  if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
2149  m_xRealSizeBT->set_sensitive(false);
2150  }
2151  }
2152 
2153  const SwFormatFrameSize& rSize = rSet.Get(RES_FRM_SIZE);
2154  sal_Int64 nWidth = m_xWidthED->NormalizePercent(rSize.GetWidth());
2155  sal_Int64 nHeight = m_xHeightED->NormalizePercent(rSize.GetHeight());
2156 
2157  if (nWidth != m_xWidthED->get_value(FieldUnit::TWIP))
2158  m_xWidthED->set_value(nWidth, FieldUnit::TWIP);
2159 
2160  if (nHeight != m_xHeightED->get_value(FieldUnit::TWIP))
2161  m_xHeightED->set_value(nHeight, FieldUnit::TWIP);
2162 
2163  if (!IsInGraficMode())
2164  {
2165  SwFrameSize eSize = rSize.GetHeightSizeType();
2166  bool bCheck = eSize != SwFrameSize::Fixed;
2167  m_xAutoHeightCB->set_active(bCheck);
2168  HandleAutoCB( bCheck, *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get() );
2169  if( eSize == SwFrameSize::Variable )
2170  m_xHeightED->set_value(m_xHeightED->get_min());
2171 
2172  eSize = rSize.GetWidthSizeType();
2173  bCheck = eSize != SwFrameSize::Fixed;
2174  m_xAutoWidthCB->set_active(bCheck);
2175  HandleAutoCB( bCheck, *m_xWidthFT, *m_xWidthAutoFT, *m_xWidthED->get() );
2176  if( eSize == SwFrameSize::Variable )
2177  m_xWidthED->set_value(m_xWidthED->get_min());
2178 
2179  if ( !m_bFormat )
2180  {
2182  const SwFrameFormat* pFormat = pSh->GetFlyFrameFormat();
2183  if( pFormat && pFormat->GetChain().GetNext() )
2184  m_xAutoHeightCB->set_sensitive( false );
2185  }
2186  }
2187  else
2188  m_xAutoHeightCB->hide();
2189 
2190  // organise circulation-gap for character bound frames
2191  const SvxULSpaceItem &rUL = rSet.Get(RES_UL_SPACE);
2192  m_nUpperBorder = rUL.GetUpper();
2193  m_nLowerBorder = rUL.GetLower();
2194 
2195  if(SfxItemState::SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO))
2196  {
2197  m_xFixedRatioCB->set_active(static_cast<const SfxBoolItem&>(rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue());
2198  m_xFixedRatioCB->save_state();
2199  }
2200 
2201  // columns
2202  SwFormatCol aCol( rSet.Get(RES_COL) );
2203  ::FitToActualSize( aCol, static_cast<sal_uInt16>(rSize.GetWidth()) );
2204 
2205  RndStdIds eAnchorId = GetAnchor();
2206 
2207  if ( m_bNew && !m_bFormat )
2208  InitPos(eAnchorId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
2209  else
2210  {
2211  const SwFormatHoriOrient& rHori = rSet.Get(RES_HORI_ORIENT);
2212  const SwFormatVertOrient& rVert = rSet.Get(RES_VERT_ORIENT);
2213  m_nOldH = rHori.GetHoriOrient();
2214  m_nOldHRel = rHori.GetRelationOrient();
2215  m_nOldV = rVert.GetVertOrient();
2216  m_nOldVRel = rVert.GetRelationOrient();
2217 
2218  if (eAnchorId == RndStdIds::FLY_AT_PAGE)
2219  {
2220  if (m_nOldHRel == text::RelOrientation::FRAME)
2221  m_nOldHRel = text::RelOrientation::PAGE_FRAME;
2222  else if (m_nOldHRel == text::RelOrientation::PRINT_AREA)
2223  m_nOldHRel = text::RelOrientation::PAGE_PRINT_AREA;
2224  if (m_nOldVRel == text::RelOrientation::FRAME)
2225  m_nOldVRel = text::RelOrientation::PAGE_FRAME;
2226  else if (m_nOldVRel == text::RelOrientation::PRINT_AREA)
2227  m_nOldVRel = text::RelOrientation::PAGE_PRINT_AREA;
2228  }
2229 
2230  m_xMirrorPagesCB->set_active(rHori.IsPosToggle());
2231  m_xMirrorPagesCB->save_state();
2232 
2233  InitPos(eAnchorId,
2234  m_nOldH,
2235  m_nOldHRel,
2236  m_nOldV,
2237  m_nOldVRel,
2238  rHori.GetPos(),
2239  rVert.GetPos());
2240  }
2241 
2242  // transparent for example
2243  // circulation for example
2244  const SwFormatSurround& rSurround = rSet.Get(RES_SURROUND);
2245  m_aExampleWN.SetWrap( rSurround.GetSurround() );
2246 
2247  if ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH )
2248  {
2249  const SvxOpaqueItem& rOpaque = rSet.Get(RES_OPAQUE);
2250  m_aExampleWN.SetTransparent(!rOpaque.GetValue());
2251  }
2252 
2253  // switch to percent if applicable
2254  RangeModifyHdl(); // set reference values (for 100%)
2255 
2257  m_xFixedRatioCB->set_active(true);
2258  if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != SwFormatFrameSize::SYNCED &&
2259  !m_xRelWidthCB->get_active())
2260  {
2261  m_xRelWidthCB->set_active(true);
2262  RelSizeClickHdl(*m_xRelWidthCB);
2263  m_xWidthED->set_value(rSize.GetWidthPercent(), FieldUnit::PERCENT);
2264  }
2265  if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
2266  !m_xRelHeightCB->get_active())
2267  {
2268  m_xRelHeightCB->set_active(true);
2269  RelSizeClickHdl(*m_xRelHeightCB);
2270  m_xHeightED->set_value(rSize.GetHeightPercent(), FieldUnit::PERCENT);
2271  }
2272  m_xRelWidthCB->save_state();
2273  m_xRelHeightCB->save_state();
2274 
2275  if (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
2276  m_xRelWidthRelationLB->set_active(1);
2277  else
2278  m_xRelWidthRelationLB->set_active(0);
2279 
2280  if (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME)
2281  m_xRelHeightRelationLB->set_active(1);
2282  else
2283  m_xRelHeightRelationLB->set_active(0);
2284 }
2285 
2286 void SwFramePage::SetFormatUsed(bool bFormatUsed)
2287 {
2288  m_bFormat = bFormatUsed;
2289  if (m_bFormat)
2290  m_xAnchorFrame->hide();
2291 }
2292 
2294 {
2295  m_bAllowVertPositioning = bEnable;
2296  m_xVerticalFT->set_sensitive( bEnable );
2297  m_xVerticalDLB->set_sensitive( bEnable );
2298  m_xAtVertPosFT->set_sensitive( bEnable );
2299  m_xAtVertPosED->set_sensitive( bEnable );
2300  m_xVertRelationFT->set_sensitive( bEnable );
2301  m_xVertRelationLB->set_sensitive( bEnable );
2302 }
2303 
2305  : SfxTabPage(pPage, pController, "modules/swriter/ui/picturepage.ui", "PicturePage", &rSet)
2306  , m_bHtmlMode(false)
2307  , m_xMirror(m_xBuilder->weld_widget("flipframe"))
2308  , m_xMirrorVertBox(m_xBuilder->weld_check_button("vert"))
2309  , m_xMirrorHorzBox(m_xBuilder->weld_check_button("hori"))
2310  , m_xAllPagesRB(m_xBuilder->weld_radio_button("allpages"))
2311  , m_xLeftPagesRB(m_xBuilder->weld_radio_button("leftpages"))
2312  , m_xRightPagesRB(m_xBuilder->weld_radio_button("rightpages"))
2313  , m_xConnectED(m_xBuilder->weld_entry("entry"))
2314  , m_xBrowseBT(m_xBuilder->weld_button("browse"))
2315  , m_xLinkFrame(m_xBuilder->weld_frame("linkframe"))
2316  // RotGrfFlyFrame: Need Angle and RotateControls now
2317  , m_xFlAngle(m_xBuilder->weld_frame("FL_ANGLE"))
2318  , m_xNfAngle(m_xBuilder->weld_metric_spin_button("NF_ANGLE", FieldUnit::DEGREE))
2319  , m_xCtlAngle(new svx::DialControl(m_xBuilder->weld_scrolled_window("anglepreview")))
2320  , m_xCtlAngleWin(new weld::CustomWeld(*m_xBuilder, "CTL_ANGLE", *m_xCtlAngle))
2321  , m_xBmpWin(new weld::CustomWeld(*m_xBuilder, "preview", m_aBmpWin))
2322 {
2323  m_aBmpWin.SetBitmapEx(BitmapEx(RID_BMP_PREVIEW_FALLBACK));
2324 
2325  m_xCtlAngle->SetLinkedField(m_xNfAngle.get(), 2);
2326 
2328  m_xMirrorHorzBox->connect_toggled(LINK(this, SwGrfExtPage, MirrorHdl));
2329  m_xMirrorVertBox->connect_toggled(LINK(this, SwGrfExtPage, MirrorHdl));
2330  m_xBrowseBT->connect_clicked(LINK(this, SwGrfExtPage, BrowseHdl));
2331 }
2332 
2334 {
2335  m_xBmpWin.reset();
2336  m_xCtlAngleWin.reset();
2337  m_xCtlAngle.reset();
2338  m_xGrfDlg.reset();
2339 }
2340 
2341 std::unique_ptr<SfxTabPage> SwGrfExtPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
2342 {
2343  return std::make_unique<SwGrfExtPage>(pPage, pController, *rSet);
2344 }
2345 
2347 {
2348  const SfxPoolItem* pItem;
2349  const sal_uInt16 nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
2350  m_bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
2351 
2352  if( SfxItemState::SET == rSet->GetItemState( FN_PARAM_GRF_CONNECT, true, &pItem)
2353  && static_cast<const SfxBoolItem *>(pItem)->GetValue() )
2354  {
2355  m_xBrowseBT->set_sensitive(true);
2356  m_xConnectED->set_editable(true);
2357  }
2358 
2359  // RotGrfFlyFrame: Get RotationAngle and set at control
2360  if(SfxItemState::SET == rSet->GetItemState( SID_ATTR_TRANSFORM_ANGLE, false, &pItem))
2361  {
2362  m_xCtlAngle->SetRotation(static_cast<const SfxInt32Item*>(pItem)->GetValue());
2363  }
2364  else
2365  {
2366  m_xCtlAngle->SetRotation(0);
2367  }
2368  m_xCtlAngle->SaveValue();
2369 
2370  ActivatePage(*rSet);
2371 }
2372 
2374 {
2375  const SvxProtectItem& rProt = rSet.Get(RES_PROTECT);
2376  bool bProtContent = rProt.IsContentProtected();
2377 
2378  const SfxPoolItem* pItem = nullptr;
2379  bool bEnable = false;
2380  bool bEnableMirrorRB = false;
2381 
2382  SfxItemState eState = rSet.GetItemState(RES_GRFATR_MIRRORGRF, true, &pItem);
2383  if (SfxItemState::UNKNOWN != eState && !bProtContent && !m_bHtmlMode)
2384  {
2385  if( SfxItemState::SET != eState )
2386  pItem = &rSet.Get( RES_GRFATR_MIRRORGRF );
2387 
2388  bEnable = true;
2389 
2390  MirrorGraph eMirror = static_cast<const SwMirrorGrf* >(pItem)->GetValue();
2391  switch( eMirror )
2392  {
2393  case MirrorGraph::Dont: break;
2394  case MirrorGraph::Vertical: m_xMirrorHorzBox->set_active(true); break;
2395  case MirrorGraph::Horizontal: m_xMirrorVertBox->set_active(true); break;
2396  case MirrorGraph::Both: m_xMirrorHorzBox->set_active(true);
2397  m_xMirrorVertBox->set_active(true);
2398  break;
2399  default:
2400  ;
2401  }
2402 
2403  const int nPos = (static_cast<const SwMirrorGrf* >(pItem)->IsGrfToggle() ? 1 : 0)
2404  + ((eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both) ? 2 : 0);
2405 
2406  bEnableMirrorRB = nPos != 0;
2407 
2408  switch (nPos)
2409  {
2410  case 1: // mirror at left / even pages
2411  m_xLeftPagesRB->set_active(true);
2412  m_xMirrorHorzBox->set_active(true);
2413  break;
2414  case 2: // mirror on all pages
2415  m_xAllPagesRB->set_active(true);
2416  break;
2417  case 3: // mirror on right / odd pages
2418  m_xRightPagesRB->set_active(true);
2419  break;
2420  default:
2421  m_xAllPagesRB->set_active(true);
2422  break;
2423  }
2424  }
2425 
2426  if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, false, &pItem ) )
2427  {
2428  const SvxBrushItem& rBrush = *static_cast<const SvxBrushItem*>(pItem);
2429  if( !rBrush.GetGraphicLink().isEmpty() )
2430  {
2431  aGrfName = aNewGrfName = rBrush.GetGraphicLink();
2432  m_xConnectED->set_text(aNewGrfName);
2433  }
2434  OUString referer;
2435  SfxStringItem const * it = static_cast<SfxStringItem const *>(
2436  rSet.GetItem(SID_REFERER));
2437  if (it != nullptr) {
2438  referer = it->GetValue();
2439  }
2440  const Graphic* pGrf = rBrush.GetGraphic(referer);
2441  if( pGrf )
2442  m_aBmpWin.SetGraphic( *pGrf );
2443  }
2444 
2445  m_xConnectED->save_value();
2446 
2447  m_xMirror->set_sensitive(bEnable);
2448  m_xAllPagesRB->set_sensitive(bEnableMirrorRB);
2449  m_xLeftPagesRB->set_sensitive(bEnableMirrorRB);
2450  m_xRightPagesRB->set_sensitive(bEnableMirrorRB);
2451 
2452  m_xAllPagesRB->save_state();
2453  m_xLeftPagesRB->save_state();
2454  m_xRightPagesRB->save_state();
2455  m_xMirrorHorzBox->save_state();
2456  m_xMirrorVertBox->save_state();
2457 
2458  m_aBmpWin.MirrorHorz( m_xMirrorVertBox->get_active() );
2459  m_aBmpWin.MirrorVert( m_xMirrorHorzBox->get_active() );
2461 }
2462 
2464 {
2465  bool bModified = false;
2466  if ( m_xMirrorHorzBox->get_state_changed_from_saved() ||
2467  m_xMirrorVertBox->get_state_changed_from_saved() ||
2468  m_xAllPagesRB->get_state_changed_from_saved() ||
2469  m_xLeftPagesRB->get_state_changed_from_saved() ||
2470  m_xRightPagesRB->get_state_changed_from_saved() )
2471  {
2472  bModified = true;
2473 
2474  bool bHori = false;
2475 
2476  if (m_xMirrorHorzBox->get_active() &&
2477  !m_xLeftPagesRB->get_active())
2478  bHori = true;
2479 
2480  MirrorGraph eMirror;
2481  eMirror = m_xMirrorVertBox->get_active() && bHori ?
2482  MirrorGraph::Both : bHori ?
2483  MirrorGraph::Vertical : m_xMirrorVertBox->get_active() ?
2485 
2486  bool bMirror = !m_xAllPagesRB->get_active();
2487  SwMirrorGrf aMirror( eMirror );
2488  aMirror.SetGrfToggle(bMirror );
2489  rSet->Put( aMirror );
2490  }
2491 
2492  if (aGrfName != aNewGrfName || m_xConnectED->get_value_changed_from_saved())
2493  {
2494  bModified = true;
2495  aGrfName = m_xConnectED->get_text();
2497  SID_ATTR_GRAF_GRAPHIC ));
2498  }
2499 
2500  // RotGrfFlyFrame: Safe rotation if modified
2501  if(m_xCtlAngle->IsValueModified())
2502  {
2503  rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), m_xCtlAngle->GetRotation()));
2504  bModified = true;
2505  }
2506 
2507  return bModified;
2508 }
2509 
2511 {
2512  if( _pSet )
2513  FillItemSet( _pSet );
2514  return DeactivateRC::LeavePage;
2515 }
2516 
2518 {
2519  if(!m_xGrfDlg)
2520  {
2521  m_xGrfDlg.reset(new FileDialogHelper(
2522  ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
2523  FileDialogFlags::Graphic, GetFrameWeld()));
2524  m_xGrfDlg->SetTitle(m_xLinkFrame->get_label());
2525  }
2526  m_xGrfDlg->SetDisplayDirectory(m_xConnectED->get_text());
2527  uno::Reference < ui::dialogs::XFilePicker3 > xFP = m_xGrfDlg->GetFilePicker();
2528  uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY);
2529  xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, uno::makeAny(true) );
2530 
2531  if ( m_xGrfDlg->Execute() != ERRCODE_NONE )
2532  return;
2533 
2534 // remember selected filter
2535  aFilterName = m_xGrfDlg->GetCurrentFilter();
2536  aNewGrfName = INetURLObject::decode( m_xGrfDlg->GetPath(),
2538  m_xConnectED->set_text(aNewGrfName);
2539  //reset mirrors because maybe a Bitmap was swapped with
2540  //another type of graphic that cannot be mirrored.
2541  m_xMirrorVertBox->set_active(false);
2542  m_xMirrorHorzBox->set_active(false);
2543  m_xAllPagesRB->set_sensitive(false);
2544  m_xLeftPagesRB->set_sensitive(false);
2545  m_xRightPagesRB->set_sensitive(false);
2546  m_aBmpWin.MirrorHorz(false);
2547  m_aBmpWin.MirrorVert(false);
2548 
2549  Graphic aGraphic;
2550  (void)GraphicFilter::LoadGraphic(m_xGrfDlg->GetPath(), OUString(), aGraphic);
2551  m_aBmpWin.SetGraphic(aGraphic);
2552 
2553  bool bEnable = GraphicType::Bitmap == aGraphic.GetType() ||
2554  GraphicType::GdiMetafile == aGraphic.GetType();
2555  m_xMirrorVertBox->set_sensitive(bEnable);
2556  m_xMirrorHorzBox->set_sensitive(bEnable);
2557  m_xAllPagesRB->set_sensitive(bEnable);
2558  m_xLeftPagesRB->set_sensitive(bEnable);
2559  m_xRightPagesRB->set_sensitive(bEnable);
2560 
2561 }
2562 
2564 {
2565  bool bEnable = m_xMirrorHorzBox->get_active();
2566 
2567  m_aBmpWin.MirrorHorz( m_xMirrorVertBox->get_active() );
2568  m_aBmpWin.MirrorVert( bEnable );
2569 
2570  m_xAllPagesRB->set_sensitive(bEnable);
2571  m_xLeftPagesRB->set_sensitive(bEnable);
2572  m_xRightPagesRB->set_sensitive(bEnable);
2573 
2574  if (!m_xAllPagesRB->get_active() && !m_xLeftPagesRB->get_active() && !m_xRightPagesRB->get_active())
2575  m_xAllPagesRB->set_active(true);
2576 }
2577 
2578 // example window
2580  : bHorz(false)
2581  , bVert(false)
2582  , bGraphic(false)
2583 {
2584 }
2585 
2587 {
2588  CustomWidgetController::SetDrawingArea(pDrawingArea);
2589  Size aSize = pDrawingArea->get_ref_device().LogicToPixel(Size(127 , 66), MapMode(MapUnit::MapAppFont));
2590  set_size_request(aSize.Width(), aSize.Height());
2591  SetOutputSizePixel(aSize);
2592 }
2593 
2595 {
2596  // Setup
2597  rRenderContext.SetBackground();
2598  // #i119307# the graphic might have transparency, set up white as the color
2599  // to use when drawing a rectangle under the image
2600  rRenderContext.SetLineColor(COL_WHITE);
2601  rRenderContext.SetFillColor(COL_WHITE);
2602 
2603  // Paint
2604  Point aPntPos;
2605  Size aPntSz(GetOutputSizePixel());
2606  Size aGrfSize;
2607  if (bGraphic)
2608  aGrfSize = ::GetGraphicSizeTwip(aGraphic, &rRenderContext);
2609  //it should show the default bitmap also if no graphic can be found
2610  if (!aGrfSize.Width() && !aGrfSize.Height())
2611  aGrfSize = rRenderContext.PixelToLogic(aBmp.GetSizePixel());
2612 
2613  long nRelGrf = aGrfSize.Width() * 100 / aGrfSize.Height();
2614  long nRelWin = aPntSz.Width() * 100 / aPntSz.Height();
2615  if (nRelGrf < nRelWin)
2616  {
2617  const long nWidth = aPntSz.Width();
2618  // if we use a replacement preview, try to draw at original size
2619  if (!bGraphic && (aGrfSize.Width() <= aPntSz.Width())
2620  && (aGrfSize.Height() <= aPntSz.Height()))
2621  {
2622  const long nHeight = aPntSz.Height();
2623  aPntSz.setWidth( aGrfSize.Width() );
2624  aPntSz.setHeight( aGrfSize.Height() );
2625  aPntPos.AdjustY((nHeight - aPntSz.Height()) / 2 );
2626  }
2627  else
2628  aPntSz.setWidth( aPntSz.Height() * nRelGrf /100 );
2629 
2630  aPntPos.AdjustX(nWidth - aPntSz.Width() ) ;
2631  }
2632 
2633  // #i119307# clear window background, the graphic might have transparency
2634  rRenderContext.DrawRect(tools::Rectangle(aPntPos, aPntSz));
2635 
2636  if (bHorz || bVert)
2637  {
2638  BitmapEx aTmpBmp(bGraphic ? aGraphic.GetBitmapEx() : aBmp);
2639  BmpMirrorFlags nMirrorFlags(BmpMirrorFlags::NONE);
2640  if (bHorz)
2641  nMirrorFlags |= BmpMirrorFlags::Vertical;
2642  if (bVert)
2643  nMirrorFlags |= BmpMirrorFlags::Horizontal;
2644  aTmpBmp.Mirror(nMirrorFlags);
2645  rRenderContext.DrawBitmapEx(aPntPos, aPntSz, aTmpBmp);
2646  }
2647  else if (bGraphic) //draw unmirrored preview graphic
2648  {
2649  aGraphic.Draw(&rRenderContext, aPntPos, aPntSz);
2650  }
2651  else //draw unmirrored stock sample image
2652  {
2653  rRenderContext.DrawBitmapEx(aPntPos, aPntSz, aBmp);
2654  }
2655 }
2656 
2658 {
2659 }
2660 
2661 void BmpWindow::SetGraphic(const Graphic& rGraphic)
2662 {
2663  aGraphic = rGraphic;
2664  Size aSize = aGraphic.GetPrefSize();
2665  bGraphic = aSize.Width() && aSize.Height();
2666  Invalidate();
2667 }
2668 
2670 {
2671  aBmp = rBmp;
2672  Invalidate();
2673 }
2674 
2675 // set URL and ImageMap at frames
2677  : SfxTabPage(pPage, pController, "modules/swriter/ui/frmurlpage.ui", "FrameURLPage", &rSet)
2678  , m_xURLED(m_xBuilder->weld_entry("url"))
2679  , m_xSearchPB(m_xBuilder->weld_button("search"))
2680  , m_xNameED(m_xBuilder->weld_entry("name"))
2681  , m_xFrameCB(m_xBuilder->weld_combo_box("frame"))
2682  , m_xServerCB(m_xBuilder->weld_check_button("server"))
2683  , m_xClientCB(m_xBuilder->weld_check_button("client"))
2684 {
2685  m_xSearchPB->connect_clicked(LINK(this, SwFrameURLPage, InsertFileHdl));
2686 }
2687 
2689 {
2690 }
2691 
2693 {
2694  const SfxPoolItem* pItem;
2695  if ( SfxItemState::SET == rSet->GetItemState( SID_DOCFRAME, true, &pItem))
2696  {
2697  std::unique_ptr<TargetList> pList(new TargetList);
2699  size_t nCount = pList->size();
2700  for (size_t i = 0; i < nCount; ++i)
2701  {
2702  m_xFrameCB->append_text(pList->at(i));
2703  }
2704  }
2705 
2706  if ( SfxItemState::SET == rSet->GetItemState( RES_URL, true, &pItem ) )
2707  {
2708  const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem);
2709  m_xURLED->set_text(INetURLObject::decode(pFormatURL->GetURL(),
2711  m_xNameED->set_text(pFormatURL->GetName());
2712 
2713  m_xClientCB->set_sensitive(pFormatURL->GetMap() != nullptr);
2714  m_xClientCB->set_active(pFormatURL->GetMap() != nullptr);
2715  m_xServerCB->set_active(pFormatURL->IsServerMap());
2716 
2717  m_xFrameCB->set_entry_text(pFormatURL->GetTargetFrameName());
2718  m_xFrameCB->save_value();
2719  }
2720  else
2721  m_xClientCB->set_sensitive(false);
2722 
2723  m_xServerCB->save_state();
2724  m_xClientCB->save_state();
2725 }
2726 
2728 {
2729  bool bModified = false;
2730  const SwFormatURL* pOldURL = GetOldItem(*rSet, RES_URL);
2731  std::unique_ptr<SwFormatURL> pFormatURL;
2732  if(pOldURL)
2733  pFormatURL.reset(pOldURL->Clone());
2734  else
2735  pFormatURL.reset(new SwFormatURL());
2736 
2737  {
2738  const OUString sText = m_xURLED->get_text();
2739 
2740  if( pFormatURL->GetURL() != sText ||
2741  pFormatURL->GetName() != m_xNameED->get_text() ||
2742  m_xServerCB->get_active() != pFormatURL->IsServerMap() )
2743  {
2744  pFormatURL->SetURL(sText, m_xServerCB->get_active());
2745  pFormatURL->SetName(m_xNameED->get_text());
2746  bModified = true;
2747  }
2748  }
2749 
2750  if (!m_xClientCB->get_active() && pFormatURL->GetMap() != nullptr)
2751  {
2752  pFormatURL->SetMap(nullptr);
2753  bModified = true;
2754  }
2755 
2756  if(pFormatURL->GetTargetFrameName() != m_xFrameCB->get_active_text())
2757  {
2758  pFormatURL->SetTargetFrameName(m_xFrameCB->get_active_text());
2759  bModified = true;
2760  }
2761  rSet->Put(*pFormatURL);
2762  return bModified;
2763 }
2764 
2765 std::unique_ptr<SfxTabPage> SwFrameURLPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
2766 {
2767  return std::make_unique<SwFrameURLPage>(pPage, pController, *rSet);
2768 }
2769 
2771 {
2772  FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
2773  FileDialogFlags::NONE, GetFrameWeld());
2774  uno::Reference < ui::dialogs::XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
2775 
2776  try
2777  {
2778  const OUString sTemp(m_xURLED->get_text());
2779  if(!sTemp.isEmpty())
2780  xFP->setDisplayDirectory(sTemp);
2781  }
2782  catch( const uno::Exception& ) {}
2783  if( aDlgHelper.Execute() == ERRCODE_NONE )
2784  {
2785  m_xURLED->set_text(xFP->getSelectedFiles().getConstArray()[0]);
2786  }
2787 }
2788 
2790  : SfxTabPage(pPage, pController, "modules/swriter/ui/frmaddpage.ui", "FrameAddPage", &rSet)
2791  , m_pWrtSh(nullptr)
2792  , m_bHtmlMode(false)
2793  , m_bFormat(false)
2794  , m_bNew(false)
2795  , m_xNameFrame(m_xBuilder->weld_widget("nameframe"))
2796  , m_xNameFT(m_xBuilder->weld_label("name_label"))
2797  , m_xNameED(m_xBuilder->weld_entry("name"))
2798  , m_xAltNameFT(m_xBuilder->weld_label("altname_label"))
2799  , m_xAltNameED(m_xBuilder->weld_entry("altname"))
2800  , m_xDescriptionFT(m_xBuilder->weld_label("description_label"))
2801  , m_xDescriptionED(m_xBuilder->weld_text_view("description"))
2802  , m_xPrevFT(m_xBuilder->weld_label("prev_label"))
2803  , m_xPrevLB(m_xBuilder->weld_combo_box("prev"))
2804  , m_xNextFT(m_xBuilder->weld_label("next_label"))
2805  , m_xNextLB(m_xBuilder->weld_combo_box("next"))
2806  , m_xProtectFrame(m_xBuilder->weld_widget("protect"))
2807  , m_xProtectContentCB(m_xBuilder->weld_check_button("protectcontent"))
2808  , m_xProtectFrameCB(m_xBuilder->weld_check_button("protectframe"))
2809  , m_xProtectSizeCB(m_xBuilder->weld_check_button("protectsize"))
2810  , m_xContentAlignFrame(m_xBuilder->weld_widget("contentalign"))
2811  , m_xVertAlignLB(m_xBuilder->weld_combo_box("vertalign"))
2812  , m_xPropertiesFrame(m_xBuilder->weld_widget("properties"))
2813  , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editinreadonly"))
2814  , m_xPrintFrameCB(m_xBuilder->weld_check_button("printframe"))
2815  , m_xTextFlowFT(m_xBuilder->weld_label("textflow_label"))
2816  , m_xTextFlowLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textflow")))
2817 {
2818  m_xTextFlowLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR));
2819  m_xTextFlowLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL));
2820  m_xTextFlowLB->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
2821  m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
2822  m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_BT, SvxResId(RID_SVXSTR_PAGEDIR_LTR_BTT_VERT));
2823  m_xTextFlowLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER));
2824  m_xDescriptionED->set_size_request(-1, m_xDescriptionED->get_preferred_size().Height());
2825 }
2826 
2828 {
2829  m_xTextFlowLB.reset();
2830 }
2831 
2832 std::unique_ptr<SfxTabPage> SwFrameAddPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
2833 {
2834  return std::make_unique<SwFrameAddPage>(pPage, pController, *rSet);
2835 }
2836 
2838 {
2839  const SfxPoolItem* pItem;
2840  sal_uInt16 nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
2841  m_bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
2842  if (m_bHtmlMode)
2843  {
2844  m_xProtectFrame->hide();
2845  m_xEditInReadonlyCB->hide();
2846  m_xPrintFrameCB->hide();
2847  }
2848  if (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog")
2849  {
2850  m_xEditInReadonlyCB->hide();
2851  if (m_bHtmlMode)
2852  {
2853  m_xPropertiesFrame->hide();
2854  }
2855  m_xContentAlignFrame->hide();
2856  }
2857 
2858  if(SfxItemState::SET == rSet->GetItemState(FN_SET_FRM_ALT_NAME, false, &pItem))
2859  {
2860  m_xAltNameED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue());
2861  m_xAltNameED->save_value();
2862  }
2863 
2864  if(SfxItemState::SET == rSet->GetItemState(FN_UNO_DESCRIPTION, false, &pItem))
2865  {
2866  m_xDescriptionED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue());
2867  m_xDescriptionED->save_value();
2868  }
2869 
2870  if(!m_bFormat)
2871  {
2872  // insert graphic - properties
2873  // bNew is not set, so recognise by selection
2874  OUString aTmpName1;
2875  if(SfxItemState::SET == rSet->GetItemState(FN_SET_FRM_NAME, false, &pItem))
2876  {
2877  aTmpName1 = static_cast<const SfxStringItem*>(pItem)->GetValue();
2878  }
2879 
2880  OSL_ENSURE(m_pWrtSh, "no Shell?");
2881  if( m_bNew || aTmpName1.isEmpty() )
2882  {
2883  if (m_sDlgType == "PictureDialog")
2884  aTmpName1 = m_pWrtSh->GetUniqueGrfName();
2885  else if (m_sDlgType == "ObjectDialog")
2886  aTmpName1 = m_pWrtSh->GetUniqueOLEName();
2887  else
2888  aTmpName1 = m_pWrtSh->GetUniqueFrameName();
2889 
2890  m_pWrtSh->SetFlyName(aTmpName1);
2891  }
2892 
2893  m_xNameED->set_text( aTmpName1 );
2894  m_xNameED->save_value();
2895  }
2896  else
2897  {
2898  m_xNameED->set_sensitive( false );
2899  m_xAltNameED->set_sensitive(false);
2900  m_xNameFT->set_sensitive( false );
2901  m_xAltNameFT->set_sensitive(false);
2902  }
2903  if (m_sDlgType == "FrameDialog" && m_xAltNameFT->get_visible())
2904  {
2905  m_xAltNameFT->hide();
2906  m_xAltNameED->hide();
2907  }
2908  else
2909  {
2910  m_xNameED->connect_changed(LINK(this, SwFrameAddPage, EditModifyHdl));
2911  }
2912 
2913  if (!m_bNew)
2914  {
2916 
2917  if (pFormat)
2918  {
2919  const SwFormatChain &rChain = pFormat->GetChain();
2920  const SwFlyFrameFormat* pFlyFormat;
2921  OUString sNextChain, sPrevChain;
2922  if ((pFlyFormat = rChain.GetPrev()) != nullptr)
2923  {
2924  sPrevChain = pFlyFormat->GetName();
2925  }
2926 
2927  if ((pFlyFormat = rChain.GetNext()) != nullptr)
2928  {
2929  sNextChain = pFlyFormat->GetName();
2930  }
2931  //determine chainable frames
2932  std::vector< OUString > aPrevPageFrames;
2933  std::vector< OUString > aThisPageFrames;
2934  std::vector< OUString > aNextPageFrames;
2935  std::vector< OUString > aRemainFrames;
2936  m_pWrtSh->GetConnectableFrameFormats(*pFormat, sNextChain, false,
2937  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
2938  for (sal_Int32 nEntry = m_xPrevLB->get_count(); nEntry > 1; nEntry--)
2939  m_xPrevLB->remove(nEntry - 1);
2940  lcl_InsertVectors(*m_xPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
2941  if(!sPrevChain.isEmpty())
2942  {
2943  if (m_xPrevLB->find_text(sPrevChain) == -1)
2944  m_xPrevLB->insert_text(1, sPrevChain);
2945  m_xPrevLB->set_active_text(sPrevChain);
2946  }
2947  else
2948  m_xPrevLB->set_active(0);
2949  aPrevPageFrames.clear();
2950  aNextPageFrames.clear();
2951  aThisPageFrames.clear();
2952  aRemainFrames.clear();
2953 
2954  m_pWrtSh->GetConnectableFrameFormats(*pFormat, sPrevChain, true,
2955  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
2956  for (sal_Int32 nEntry = m_xNextLB->get_count(); nEntry > 1; nEntry--)
2957  m_xNextLB->remove(nEntry - 1);
2958  lcl_InsertVectors(*m_xNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
2959  if(!sNextChain.isEmpty())
2960  {
2961  if (m_xNextLB->find_text(sNextChain) == -1)
2962  m_xNextLB->insert_text(1, sNextChain);
2963  m_xNextLB->set_active_text(sNextChain);
2964  }
2965  else
2966  m_xNextLB->set_active(0);
2967  Link<weld::ComboBox&,void> aLink(LINK(this, SwFrameAddPage, ChainModifyHdl));
2968  m_xPrevLB->connect_changed(aLink);
2969  m_xNextLB->connect_changed(aLink);
2970  }
2971  }
2972  // Pos Protected
2973  const SvxProtectItem& rProt = rSet->Get(RES_PROTECT);
2974  m_xProtectFrameCB->set_active(rProt.IsPosProtected());
2975  m_xProtectContentCB->set_active(rProt.IsContentProtected());
2976  m_xProtectSizeCB->set_active(rProt.IsSizeProtected());
2977 
2979  m_xEditInReadonlyCB->set_active(rEdit.GetValue());
2980  m_xEditInReadonlyCB->save_state();
2981 
2982  // print
2983  const SvxPrintItem& rPrt = rSet->Get(RES_PRINT);
2984  m_xPrintFrameCB->set_active(rPrt.GetValue());
2985  m_xPrintFrameCB->save_state();
2986 
2987  // textflow
2988  if( (!m_bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES)))
2989  && m_sDlgType != "PictureDialog" && m_sDlgType != "ObjectDialog"
2990  && SfxItemState::UNKNOWN != rSet->GetItemState( RES_FRAMEDIR ) )
2991  {
2992  m_xTextFlowFT->show();
2993  m_xTextFlowLB->show();
2994 
2995  //vertical text flow is not possible in HTML
2996  if(m_bHtmlMode)
2997  {
2998  m_xTextFlowLB->remove_id(SvxFrameDirection::Vertical_RL_TB);
2999  }
3000  SvxFrameDirection nVal = rSet->Get(RES_FRAMEDIR).GetValue();
3001  m_xTextFlowLB->set_active_id(nVal);
3002  m_xTextFlowLB->save_value();
3003  }
3004  else
3005  {
3006  m_xTextFlowFT->hide();
3007  m_xTextFlowLB->hide();
3008  }
3009 
3010  // Content alignment
3011  if ( rSet->GetItemState(RES_TEXT_VERT_ADJUST) > SfxItemState::DEFAULT )
3012  {
3013  SdrTextVertAdjust nAdjust = rSet->Get(RES_TEXT_VERT_ADJUST).GetValue();
3014  sal_Int32 nPos = 0;
3015  switch(nAdjust)
3016  {
3017  case SDRTEXTVERTADJUST_TOP: nPos = 0; break;
3019  case SDRTEXTVERTADJUST_BLOCK: nPos = 1; break;
3020  case SDRTEXTVERTADJUST_BOTTOM: nPos = 2; break;
3021  }
3022  m_xVertAlignLB->set_active(nPos);
3023  }
3024  m_xVertAlignLB->save_value();
3025 }
3026 
3028 {
3029  bool bRet = false;
3030  if (m_xNameED->get_value_changed_from_saved())
3031  bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_NAME, m_xNameED->get_text()));
3032  if (m_xAltNameED->get_value_changed_from_saved())
3033  bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_ALT_NAME, m_xAltNameED->get_text()));
3034  if (m_xDescriptionED->get_value_changed_from_saved())
3035  bRet |= nullptr != rSet->Put(SfxStringItem(FN_UNO_DESCRIPTION, m_xDescriptionED->get_text()));
3036 
3037  const SfxPoolItem* pOldItem;
3039  aProt.SetContentProtect( m_xProtectContentCB->get_active() );
3040  aProt.SetSizeProtect ( m_xProtectSizeCB->get_active() );
3041  aProt.SetPosProtect ( m_xProtectFrameCB->get_active() );
3042  if ( nullptr == (pOldItem = GetOldItem(*rSet, FN_SET_PROTECT)) ||
3043  aProt != *pOldItem )
3044  bRet |= nullptr != rSet->Put( aProt);
3045 
3046  if ( m_xEditInReadonlyCB->get_state_changed_from_saved() )
3047  bRet |= nullptr != rSet->Put( SwFormatEditInReadonly( RES_EDIT_IN_READONLY, m_xEditInReadonlyCB->get_active()));
3048 
3049  if ( m_xPrintFrameCB->get_state_changed_from_saved() )
3050  bRet |= nullptr != rSet->Put( SvxPrintItem( RES_PRINT, m_xPrintFrameCB->get_active()));
3051 
3052  // textflow
3053  if (m_xTextFlowLB->get_visible() && m_xTextFlowLB->get_value_changed_from_saved())
3054  {
3055  SvxFrameDirection eDirection = m_xTextFlowLB->get_active_id();
3056  bRet |= nullptr != rSet->Put( SvxFrameDirectionItem(eDirection, RES_FRAMEDIR ));
3057  }
3058  if(m_pWrtSh)
3059  {
3060  const SwFrameFormat* pFormat = m_pWrtSh->GetFlyFrameFormat();
3061  if (pFormat)
3062  {
3063  OUString sCurrentPrevChain, sCurrentNextChain;
3064  if (m_xPrevLB->get_active())
3065  sCurrentPrevChain = m_xPrevLB->get_active_text();
3066  if (m_xNextLB->get_active())
3067  sCurrentNextChain = m_xNextLB->get_active_text();
3068  const SwFormatChain &rChain = pFormat->GetChain();
3069  const SwFlyFrameFormat* pFlyFormat;
3070  OUString sNextChain, sPrevChain;
3071  if ((pFlyFormat = rChain.GetPrev()) != nullptr)
3072  sPrevChain = pFlyFormat->GetName();
3073 
3074  if ((pFlyFormat = rChain.GetNext()) != nullptr)
3075  sNextChain = pFlyFormat->GetName();
3076  if(sPrevChain != sCurrentPrevChain)
3077  bRet |= nullptr != rSet->Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS, sCurrentPrevChain));
3078  if(sNextChain != sCurrentNextChain)
3079  bRet |= nullptr != rSet->Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain));
3080  }
3081  }
3082 
3083  if (m_xVertAlignLB->get_value_changed_from_saved())
3084  {
3085  SdrTextVertAdjust nAdjust;
3086  switch (m_xVertAlignLB->get_active())
3087  {
3088  default:
3089  case 0 : nAdjust = SDRTEXTVERTADJUST_TOP; break;
3090  case 1 : nAdjust = SDRTEXTVERTADJUST_CENTER; break;
3091  case 2 : nAdjust = SDRTEXTVERTADJUST_BOTTOM; break;
3092  }
3093  bRet |= nullptr != rSet->Put(SdrTextVertAdjustItem(nAdjust, RES_TEXT_VERT_ADJUST));
3094  }
3095 
3096  return bRet;
3097 }
3098 
3100 {
3101  bool bEnable = !m_xNameED->get_text().isEmpty();
3102  m_xAltNameED->set_sensitive(bEnable);
3103  m_xAltNameFT->set_sensitive(bEnable);
3104 }
3105 
3106 void SwFrameAddPage::SetFormatUsed(bool bFormatUsed)
3107 {
3108  m_bFormat = bFormatUsed;
3109  if (m_bFormat)
3110  {
3111  m_xNameFrame->hide();
3112  }
3113 }
3114 
3115 IMPL_LINK(SwFrameAddPage, ChainModifyHdl, weld::ComboBox&, rBox, void)
3116 {
3117  OUString sCurrentPrevChain, sCurrentNextChain;
3118  if (m_xPrevLB->get_active())
3119  sCurrentPrevChain = m_xPrevLB->get_active_text();
3120  if (m_xNextLB->get_active())
3121  sCurrentNextChain = m_xNextLB->get_active_text();
3122  SwFrameFormat* pFormat = m_pWrtSh->GetFlyFrameFormat();
3123  if (!pFormat)
3124  return;
3125 
3126  bool bNextBox = m_xNextLB.get() == &rBox;
3127  weld::ComboBox& rChangeLB = bNextBox ? *m_xPrevLB : *m_xNextLB;
3128  for (sal_Int32 nEntry = rChangeLB.get_count(); nEntry > 1; nEntry--)
3129  rChangeLB.remove(nEntry - 1);
3130  //determine chainable frames
3131  std::vector< OUString > aPrevPageFrames;
3132  std::vector< OUString > aThisPageFrames;
3133  std::vector< OUString > aNextPageFrames;
3134  std::vector< OUString > aRemainFrames;
3135  m_pWrtSh->GetConnectableFrameFormats(*pFormat, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
3136  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3137  lcl_InsertVectors(rChangeLB,
3138  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3139  const OUString sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
3140  if (rChangeLB.find_text(sToSelect) != -1)
3141  rChangeLB.set_active_text(sToSelect);
3142  else
3143  rChangeLB.set_active(0);
3144 
3145 }
3146 
3147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: frmpage.cxx:1699
bool GetValue() const
static FrameMap const aHCharHtmlMap[]
Definition: frmpage.cxx:315
long Width() const
#define SO3_SM_CLASSID_60
std::unique_ptr< weld::Label > m_xAtVertPosFT
Definition: frmpage.hxx:113
void SetFlyName(const OUString &rName)
Set name at selected FlyFrame.
Definition: fefly1.cxx:1426
std::unique_ptr< weld::CheckButton > m_xEditInReadonlyCB
Definition: frmpage.hxx:295
#define FN_HORI_ORIENT
Definition: cmdid.h:838
static constexpr auto VERT_PARA_REL
Definition: frmpage.cxx:284
FrameMap const * m_pHMap
Definition: frmpage.hxx:69
std::unique_ptr< weld::Label > m_xVerticalFT
Definition: frmpage.hxx:111
FieldUnit
#define RES_FRM_SIZE
Definition: hintids.hxx:289
SDRTEXTVERTADJUST_TOP
#define RES_COL
Definition: hintids.hxx:309
static FrameMap const aHFrameMap[]
Definition: frmpage.cxx:225
sal_Int32 nIndex
static FrameMap const aVCharHtmlAbsMap[]
Definition: frmpage.cxx:356
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:2341
std::unique_ptr< weld::CustomWeld > m_xCtlAngleWin
Definition: frmpage.hxx:221
#define RES_URL
Definition: hintids.hxx:311
std::unique_ptr< svx::DialControl > m_xCtlAngle
Definition: frmpage.hxx:220
std::unique_ptr< weld::RadioButton > m_xAnchorAsCharRB
Definition: frmpage.hxx:98
std::unique_ptr< weld::Widget > m_xContentAlignFrame
Definition: frmpage.hxx:291
void SetWidthPercentRelation(sal_Int16 n)
Definition: fmtfsize.hxx:96
#define RES_EDIT_IN_READONLY
Definition: hintids.hxx:312
std::unique_ptr< weld::RadioButton > m_xLeftPagesRB
Definition: frmpage.hxx:210
bool m_bAllowVertPositioning
Definition: frmpage.hxx:71
sal_uInt16 GetLower() const
static FrameMap const aHPageMap[]
Definition: frmpage.cxx:193
void EnableVerticalPositioning(bool bEnable)
Definition: frmpage.cxx:2293
OUString aFilterName
Definition: frmpage.hxx:197
static constexpr auto HORI_PARA_REL
Definition: frmpage.cxx:257
OUString m_sDlgType
Definition: frmpage.hxx:269
static FrameMap const aVPageMap[]
Definition: frmpage.cxx:208
std::unique_ptr< weld::Label > m_xAtHorzPosFT
Definition: frmpage.hxx:104
virtual SwFormatURL * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1722
long AdjustX(long nHorzMove)
#define FN_PARAM_CHAIN_PREVIOUS
Definition: cmdid.h:803
static void GetDefaultTargetList(TargetList &)
void SetGrfToggle(bool bNew)
Definition: grfatr.hxx:66
std::unique_ptr< weld::CheckButton > m_xProtectSizeCB
Definition: frmpage.hxx:289
static const sal_uInt16 aAddPgRg[]
Definition: frmpage.hxx:303
#define RES_HORI_ORIENT
Definition: hintids.hxx:303
std::string GetValue
void FitToActualSize(SwFormatCol &rCol, sal_uInt16 nWidth)
Definition: colmgr.cxx:35
void SetFormatUsed(bool bFormat)
Definition: frmpage.cxx:2286
void EnableGraficMode()
Definition: frmpage.cxx:841
long Height() const
#define FN_PARAM_GRF_CONNECT
Definition: cmdid.h:769
void append_separator(const OUString &rId)
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
static FrameMap const aVFlyHtmlMap[]
Definition: frmpage.cxx:250
bool m_bIsInRightToLeft
Definition: frmpage.hxx:49
std::unique_ptr< weld::CheckButton > m_xPrintFrameCB
Definition: frmpage.hxx:296
GPOS_LT
int n1
#define FRAME
long GetWidth() const
std::unique_ptr< weld::ComboBox > m_xRelWidthRelationLB
Definition: frmpage.hxx:81
sal_Int16 m_nOldVRel
Definition: frmpage.hxx:66
std::unique_ptr< weld::ComboBox > m_xNextLB
Definition: frmpage.hxx:284
#define MINFLY
Definition: swtypes.hxx:65
SwTwips GetPos() const
Definition: fmtornt.hxx:92
sal_uIntPtr sal_uLong
void InitPos(RndStdIds eId, sal_Int16 nH, sal_Int16 nHRel, sal_Int16 nV, sal_Int16 nVRel, long nX, long nY)
Definition: frmpage.cxx:1233
#define RES_FRAMEDIR
Definition: hintids.hxx:320
#define RES_SURROUND
Definition: hintids.hxx:301
static FrameMap const aVCharHtmlMap[]
Definition: frmpage.cxx:351
static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, bool bVertical, bool bVerticalL2R, bool bRTL)
Definition: frmpage.cxx:483
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:2692
#define FN_OLE_IS_MATH
Definition: cmdid.h:609
#define FN_SET_FRM_ALT_NAME
Definition: cmdid.h:842
LB const nLBRelations
Definition: frmpage.cxx:152
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:107
static FrameMap const aHParaHtmlAbsMap[]
Definition: frmpage.cxx:277
virtual int find_text(const OUString &rStr) const =0
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:863
#define HTML_HORI_PARA_REL
Definition: frmpage.cxx:269
sal_Int16 m_nOldHRel
Definition: frmpage.hxx:64
std::unique_ptr< weld::Label > m_xHoriRelationFT
Definition: frmpage.hxx:106
const SwPosition * mpToCharContentPos
Definition: frmpage.hxx:60
SDRTEXTVERTADJUST_BLOCK
MirrorGraph
Definition: grfatr.hxx:31
long SwTwips
Definition: swtypes.hxx:49
SwFrameAddPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:2789
SvxFrameDirection
bool GetGrfSize(Size &) const
Definition: editsh.cxx:278
std::unique_ptr< weld::Button > m_xRealSizeBT
Definition: frmpage.hxx:91
static SfxObjectShell * Current()
void append(const OUString &rId, const OUString &rStr)
static sal_Int16 GetRelation(const weld::ComboBox &rRelationLB)
Definition: frmpage.cxx:1584
bool IsSizeProtected() const
SwFramePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:624
virtual OUString get_active_id() const =0
std::unique_ptr< weld::CheckButton > m_xProtectContentCB
Definition: frmpage.hxx:287
sal_uInt16 m_nHtmlMode
Definition: frmpage.hxx:51
std::unique_ptr< weld::Button > m_xBrowseBT
Definition: frmpage.hxx:214
static FrameMap const aHParaHtmlMap[]
Definition: frmpage.cxx:271
std::unique_ptr< weld::Label > m_xHeightFT
Definition: frmpage.hxx:84
SwFrameExample m_aExampleWN
Definition: frmpage.hxx:75
virtual int get_active() const =0
std::unique_ptr< weld::Label > m_xHeightAutoFT
Definition: frmpage.hxx:85
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
#define RES_PROTECT
Definition: hintids.hxx:300
std::unique_ptr< weld::Entry > m_xNameED
Definition: frmpage.hxx:246
Value in Var-direction gives minimum (can be exceeded but not be less).
std::unique_ptr< weld::Widget > m_xPropertiesFrame
Definition: frmpage.hxx:294
virtual int get_count() const =0
Size const & GetOutputSizePixel() const
bool m_bHtmlMode
Definition: frmpage.hxx:50
#define RES_GRFATR_MIRRORGRF
Definition: hintids.hxx:334
std::unique_ptr< weld::Entry > m_xNameED
Definition: frmpage.hxx:276
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
#define FN_VERT_ORIENT
Definition: cmdid.h:837
std::unique_ptr< weld::ComboBox > m_xVertAlignLB
Definition: frmpage.hxx:292
std::unique_ptr< SwPercentField > m_xHeightED
Definition: frmpage.hxx:124
std::unique_ptr< SwPercentField > m_xWidthED
Definition: frmpage.hxx:123
bool m_bHtmlMode
Definition: frmpage.hxx:270
static FrameMap const aHFlyHtmlMap[]
Definition: frmpage.cxx:233
static FrameMap const aHCharHtmlAbsMap[]
Definition: frmpage.cxx:321
static FrameMap const aVPageHtmlMap[]
Definition: frmpage.cxx:216
void SetBackground()
std::unique_ptr< weld::MetricSpinButton > m_xNfAngle
Definition: frmpage.hxx:219
void SetVertRel(short nR)
const SwView & GetView() const
Definition: wrtsh.hxx:428
std::unique_ptr< weld::CheckButton > m_xMirrorPagesCB
Definition: frmpage.hxx:109
int n2
const SwFrameFormat * IsFlyInFly()
Is selected frame within another frame?
Definition: fefly1.cxx:308
NONE
bool m_bAtVertPosModified
Definition: frmpage.hxx:41
void RangeModifyHdl()
Definition: frmpage.cxx:1758
OUString SvxResId(const char *pId)
static RelationMap const aAsCharRelationMap[]
Definition: frmpage.cxx:182
SwWrtShell * m_pWrtSh
Definition: frmpage.hxx:267
bool m_bFormat
Definition: frmpage.hxx:43
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:2837
#define VERT_PAGE_REL
Definition: frmpage.cxx:206
std::unique_ptr< weld::Label > m_xVertRelationFT
Definition: frmpage.hxx:115
Graphic aGraphic
Definition: bmpwin.hxx:31
std::unique_ptr< weld::CheckButton > m_xClientCB
Definition: frmpage.hxx:251
const OUString & GetName() const
Definition: format.hxx:111
void SetExchangeSupport()
int nCount
void set_accessible_name(const OUString &rName)
RndStdIds GetAnchor() const
Definition: frmpage.cxx:1662
std::unique_ptr< weld::Widget > m_xAnchorFrame
Definition: frmpage.hxx:94
void UpdateExample()
Definition: frmpage.cxx:2075
#define RES_UL_SPACE
Definition: hintids.hxx:292
const Graphic * GetGraphic(OUString const &referer=OUString()) const
static OUString GetString(StringId eId)
virtual OutputDevice & get_ref_device()=0
std::unique_ptr< weld::CheckButton > m_xRelHeightCB
Definition: frmpage.hxx:86
#define RES_PRINT
Definition: hintids.hxx:298
#define HTML_HORI_CHAR_REL
Definition: frmpage.cxx:313
virtual ~SwGrfExtPage() override
Definition: frmpage.cxx:2333
bool bHorz
Definition: bmpwin.hxx:34
void SetVAlign(short nV)
void DrawRect(const tools::Rectangle &rRect)
std::unique_ptr< weld::MetricSpinButton > m_xAtVertPosED
Definition: frmpage.hxx:114
const OUString & GetName() const
Definition: fmturl.hxx:71
#define RES_FOLLOW_TEXT_FLOW
Definition: hintids.hxx:323
#define FN_PARAM_GRF_REALSIZE
Definition: cmdid.h:774
const SfxItemSet & GetItemSet() const
std::unique_ptr< weld::Label > m_xNameFT
Definition: frmpage.hxx:275
void SetWidth(long n)
#define SAL_N_ELEMENTS(arr)
void Init(const SfxItemSet &rSet)
Definition: frmpage.cxx:2102
void SetHeightPercentRelation(sal_Int16 n)
Definition: fmtfsize.hxx:94
static ErrCode LoadGraphic(const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
virtual ~SwFramePage() override
Definition: frmpage.cxx:731
BitmapEx aBmp
Definition: bmpwin.hxx:32
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
#define FN_UNO_DESCRIPTION
Definition: cmdid.h:844
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
SDRTEXTVERTADJUST_BOTTOM
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:2727
#define SO3_SM_CLASSID_50
void SetLineColor()
void set_active_text(const OUString &rStr)
std::unique_ptr< weld::Button > m_xSearchPB
Definition: frmpage.hxx:245
Style of a layout element.
Definition: frmfmt.hxx:57
void SetFormatUsed(bool bFormat)
Definition: frmpage.cxx:3106
sal_Int16 const nAlign
Definition: frmpage.cxx:151
virtual ~SwFrameAddPage() override
Definition: frmpage.cxx:2827
IMPL_LINK_NOARG(SwFramePage, MirrorHdl, weld::ToggleButton &, void)
Definition: frmpage.cxx:1721
Size m_aGrfSize
Definition: frmpage.hxx:53
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
#define RES_ANCHOR
Definition: hintids.hxx:304
Only protection that cannot be withdrawn e.g.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:698
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
#define FN_KEEP_ASPECT_RATIO
Definition: cmdid.h:840
long AdjustY(long nVertMove)
virtual ~BmpWindow() override
Definition: frmpage.cxx:2657
static FrameMap const aVParaMap[]
Definition: frmpage.cxx:287
GraphicType GetType() const
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: frmpage.cxx:2373
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:2346
bool m_bHtmlMode
Definition: frmpage.hxx:202
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
bool IsInGraficMode() const
Definition: frmpage.hxx:191
#define RES_VERT_ORIENT
Definition: hintids.hxx:302
SW_DLLPUBLIC void InsertStringSorted(const OUString &rId, const OUString &rEntry, weld::ComboBox &rToFill, int nOffset)
Definition: uitool.cxx:710
std::unique_ptr< weld::CheckButton > m_xProtectFrameCB
Definition: frmpage.hxx:288
void GetConnectableFrameFormats(SwFrameFormat &rFormat, const OUString &rReference, bool bSuccessors, std::vector< OUString > &aPrevPageVec, std::vector< OUString > &aThisPageVec, std::vector< OUString > &aNextPageVec, std::vector< OUString > &aRestVec)
Definition: fefly1.cxx:1821
sal_uInt16 GetPhyPageNum() const
Phy: real page count.
Definition: fews.cxx:334
std::unique_ptr< weld::Label > m_xHorizontalFT
Definition: frmpage.hxx:102
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:3027
static FrameMap const aHParaMap[]
Definition: frmpage.cxx:261
static FrameMap const aHCharMap[]
Definition: frmpage.cxx:305
static sal_Int16 GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, const weld::ComboBox &rRelationLB)
Definition: frmpage.cxx:1596
int i
svt::EmbeddedObjectRef & GetOLEObject() const
Get OLE object at pointer.
Definition: editsh.cxx:358
const OUString & GetValue() const
FlyAnchors.
Definition: fmtanchr.hxx:34
bool m_bNew
Definition: frmpage.hxx:44
std::unique_ptr< weld::Label > m_xWidthAutoFT
Definition: frmpage.hxx:79
HTMLMODE_ON
void SetWidthSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:84
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:337
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
#define FN_SET_PROTECT
Definition: cmdid.h:835
std::unique_ptr< svx::FrameDirectionListBox > m_xTextFlowLB
Definition: frmpage.hxx:298
void MirrorHorz(bool bMirror)
Definition: bmpwin.hxx:46
bool bGraphic
Definition: bmpwin.hxx:36
std::unique_ptr< weld::Entry > m_xURLED
Definition: frmpage.hxx:244
void SetFillColor()
bool m_bIsMathBaselineAlignment
Definition: frmpage.hxx:73
std::unique_ptr< weld::Label > m_xWidthFT
Definition: frmpage.hxx:78
std::unique_ptr< weld::CheckButton > m_xFixedRatioCB
Definition: frmpage.hxx:90
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:836
BmpMirrorFlags
std::unique_ptr< weld::Label > m_xAltNameFT
Definition: frmpage.hxx:277
std::unique_ptr< weld::CheckButton > m_xMirrorVertBox
Definition: frmpage.hxx:207
static LB lcl_GetLBRelationsForStrID(const FrameMap *_pMap, const SvxSwFramePosString::StringId _eStrId, const bool _bUseMirrorStr)
Definition: frmpage.cxx:593
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
std::unique_ptr< weld::CheckButton > m_xAutoHeightCB
Definition: frmpage.hxx:88
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: frmpage.cxx:2510
bool IsContentProtected() const
static FrameMap const aVAsCharHtmlMap[]
Definition: frmpage.cxx:380
std::unique_ptr< weld::CheckButton > m_xFollowTextFlowCB
Definition: frmpage.hxx:118
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
SwFrameSize
Definition: fmtfsize.hxx:35
void setOptimalFrameWidth()
Definition: frmpage.cxx:744
SwFrameURLPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:2676
void SetHAlign(short nH)
virtual void set_active(int pos)=0
std::unique_ptr< weld::Entry > m_xConnectED
Definition: frmpage.hxx:213
OUString SwResId(const char *pId)
Definition: swmodule.cxx:178
#define FN_MATH_BASELINE_ALIGNMENT
Definition: cmdid.h:610
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
#define MAX_PERCENT_HEIGHT
Definition: frmpage.cxx:96
virtual void clear()=0
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
OUString aGrfName
Definition: frmpage.hxx:198
std::unique_ptr< weld::Entry > m_xAltNameED
Definition: frmpage.hxx:278
static RelationMap const aRelationMap[]
Definition: frmpage.cxx:156
sal_Int16 m_nOldV
Definition: frmpage.hxx:65
OUString GetUniqueFrameName() const
Definition: feflyole.cxx:79
std::unique_ptr< weld::CheckButton > m_xRelWidthCB
Definition: frmpage.hxx:80
void SetAnchor(RndStdIds nA)
void SetOutputSizePixel(const Size &rSize)
std::unique_ptr< weld::ComboBox > m_xVerticalDLB
Definition: frmpage.hxx:112
const SfxItemSet * GetDialogExampleSet() const
Frame cannot be moved in Var-direction.
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2605
const long LONG_MAX
std::unique_ptr< weld::ComboBox > m_xRelHeightRelationLB
Definition: frmpage.hxx:87
SwDocShell * GetDocShell()
Definition: view.cxx:1107
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
std::unique_ptr< weld::ComboBox > m_xVertRelationLB
Definition: frmpage.hxx:116
std::unique_ptr< weld::Label > m_xTextFlowFT
Definition: frmpage.hxx:297
std::unique_ptr< weld::RadioButton > m_xAllPagesRB
Definition: frmpage.hxx:209
sal_Int32 FillPosLB(const FrameMap *_pMap, const sal_Int16 _nAlign, const sal_Int16 _nRel, weld::ComboBox &_rLB)
Definition: frmpage.cxx:1359
std::unique_ptr< weld::CheckButton > m_xAutoWidthCB
Definition: frmpage.hxx:82
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: frmpage.cxx:1685
sal_Int16 GetHeightPercentRelation() const
Definition: fmtfsize.hxx:89
std::unique_ptr< weld::Widget > m_xProtectFrame
Definition: frmpage.hxx:286
bool bVert
Definition: bmpwin.hxx:35
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
Size GetPrefSize() const
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: frmpage.cxx:2586
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
void SetHeightPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:93
#define FN_PARAM_CHAIN_NEXT
Definition: cmdid.h:804
const OUString & GetGraphicLink() const
SwGrfExtPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:2304
std::unique_ptr< weld::CheckButton > m_xServerCB
Definition: frmpage.hxx:250
static sal_Int32 GetMapPos(const FrameMap *pMap, const weld::ComboBox &rAlignLB)
Definition: frmpage.cxx:1629
void set_size_request(int nWidth, int nHeight)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void SetSizeProtect(bool bNew)
bool IsPosToggle() const
Definition: fmtornt.hxx:95
SfxItemState
weld::Entry & rEdit
SwTwips m_nLowerBorder
Definition: frmpage.hxx:55
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
Definition: fews.cxx:1298
SvxSwFramePosString::StringId const eStrId
Definition: frmpage.cxx:149
void SetPosProtect(bool bNew)
#define VERT_FRAME_REL
Definition: frmpage.cxx:240
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:1038
HTMLMODE_SOME_STYLES
std::unique_ptr< weld::RadioButton > m_xRightPagesRB
Definition: frmpage.hxx:211
std::unique_ptr<::sfx2::FileDialogHelper > m_xGrfDlg
Definition: frmpage.hxx:200
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static void lcl_InsertVectors(weld::ComboBox &rBox, const std::vector< OUString > &rPrev, const std::vector< OUString > &rThis, const std::vector< OUString > &rNext, const std::vector< OUString > &rRemain)
Definition: frmpage.cxx:457
static FrameMap const aVAsCharMap[]
Definition: frmpage.cxx:363
#define ERRCODE_NONE
std::unique_ptr< weld::RadioButton > m_xAnchorAtCharRB
Definition: frmpage.hxx:97
unsigned char sal_uInt8
virtual OUString get_label() const =0
std::unique_ptr< weld::RadioButton > m_xAnchorAtPageRB
Definition: frmpage.hxx:95
SwTwips GetPos() const
Definition: fmtornt.hxx:59
SwTwips m_nUpperBorder
Definition: frmpage.hxx:54
void SetWidthPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:95
const OUString & GetTargetFrameName() const
Definition: fmturl.hxx:65
bool m_bIsVerticalL2R
Definition: frmpage.hxx:48
#define FN_SET_FRM_NAME
Definition: cmdid.h:839
#define SO3_SM_CLASSID_40
#define MAX_PERCENT_WIDTH
Definition: frmpage.cxx:95
static LB lcl_GetLBRelationsForRelations(const sal_Int16 _nRel)
Definition: frmpage.cxx:576
OUString GetUniqueGrfName() const
Created unique name for frame.
Definition: fefly1.cxx:1459
SwWrtShell * getFrameDlgParentShell()
Definition: frmpage.cxx:858
IMPL_LINK(SwFramePage, RelSizeClickHdl, weld::ToggleButton &, rBtn, void)
Definition: frmpage.cxx:1727
#define RES_OPAQUE
Definition: hintids.hxx:299
static constexpr auto VERT_CHAR_REL
Definition: frmpage.cxx:329
std::unique_ptr< weld::Widget > m_xMirror
Definition: frmpage.hxx:206
bool m_bIsVerticalFrame
Definition: frmpage.hxx:46
double m_fWidthHeightRatio
Definition: frmpage.hxx:56
OUString aNewGrfName
Definition: frmpage.hxx:198
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
Definition: frmpage.cxx:2594
static FrameMap const aVFrameMap[]
Definition: frmpage.cxx:242
static constexpr auto HORI_PAGE_REL
Definition: frmpage.cxx:190
void setOptimalRelWidth()
Definition: frmpage.cxx:803
std::unique_ptr< weld::ComboBox > m_xFrameCB
Definition: frmpage.hxx:247
void SetHoriRel(short nR)
void SetHeight(long n)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:2765
static FrameMap const aVCharMap[]
Definition: frmpage.cxx:332
SfxOkDialogController * GetDialogController() const
void SetWrap(css::text::WrapTextMode nW)
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
ColumnDescriptor.
Definition: fmtclds.hxx:33
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
virtual OUString get_id(int pos) const =0
std::unique_ptr< weld::ComboBox > m_xHoriRelationLB
Definition: frmpage.hxx:107
static FrameMap const aVParaHtmlMap[]
Definition: frmpage.cxx:295
SvxSwFramePosString::StringId const eMirrorStrId
Definition: frmpage.cxx:150
std::unique_ptr< weld::Widget > m_xNameFrame
Definition: frmpage.hxx:274
void SetRelPos(const Point &rP)
std::unique_ptr< weld::ComboBox > m_xHorizontalDLB
Definition: frmpage.hxx:103
static constexpr auto HORI_CHAR_REL
Definition: frmpage.cxx:301
DeactivateRC
static constexpr auto HORI_FRAME_REL
Definition: frmpage.cxx:222
def text(shape, st)
std::unique_ptr< weld::ComboBox > m_xPrevLB
Definition: frmpage.hxx:282
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:2832
void MirrorVert(bool bMirror)
Definition: bmpwin.hxx:45
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1225
virtual void remove(int pos)=0
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
void append_text(const OUString &rStr)
RndStdIds
OUString m_sDlgType
Definition: frmpage.hxx:52
virtual ~SwFrameURLPage() override
Definition: frmpage.cxx:2688
void SetContentProtect(bool bNew)
std::unique_ptr< weld::CustomWeld > m_xBmpWin
Definition: frmpage.hxx:222
sal_Int16 m_nOldH
Definition: frmpage.hxx:63
static OUString EraseAllMnemonicChars(const OUString &rStr)
void SetTransparent(bool bT)
Frame is variable in Var-direction.
void SetGraphic(const Graphic &rGrf)
Definition: frmpage.cxx:2661
const Size & GetSizePixel() const
long GetHeight() const
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
#define SO3_SM_CLASSID_30
bool IsServerMap() const
Definition: fmturl.hxx:67
void SetHeightSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:81
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:2463
void setWidth(long nWidth)
void FillRelLB(const FrameMap *_pMap, const sal_uInt16 _nLBSelPos, const sal_Int16 _nAlign, const sal_Int16 _nRel, weld::ComboBox &_rLB, weld::Label &_rFT)
Definition: frmpage.cxx:1413
BmpWindow m_aBmpWin
Definition: frmpage.hxx:205
std::unique_ptr< weld::CheckButton > m_xMirrorHorzBox
Definition: frmpage.hxx:208
static const sal_uInt16 aPageRg[]
Definition: frmpage.hxx:176
std::unique_ptr< weld::MetricSpinButton > m_xAtHorzPosED
Definition: frmpage.hxx:105
::std::vector< OUString > TargetList
sal_Int16 GetWidthPercentRelation() const
Definition: fmtfsize.hxx:92
void ValidateMetrics(SvxSwFrameValidation &rVal, const SwPosition *pToCharContentPos, bool bOnlyPercentRefValue=false)
Definition: frmmgr.cxx:245
static size_t lcl_GetFrameMapCount(const FrameMap *pMap)
Definition: frmpage.cxx:408
static FrameMap const aHPageHtmlMap[]
Definition: frmpage.cxx:201
FrameMap const * m_pVMap
Definition: frmpage.hxx:68
SdrTextVertAdjust
bool m_bAtHorzPosModified
Definition: frmpage.hxx:40
OUString GetUniqueOLEName() const
Definition: feflyole.cxx:74
LB
virtual void set_visible(bool visible)
sal_uInt16 nPos
virtual void set_sensitive(bool sensitive)=0
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
#define RES_TEXT_VERT_ADJUST
Definition: hintids.hxx:330
void SetBitmapEx(const BitmapEx &rGrf)
Definition: frmpage.cxx:2669
bool IsPosProtected() const
sal_uInt16 GetUpper() const
virtual OUString get_active_text() const =0
SDRTEXTVERTADJUST_CENTER
std::unique_ptr< weld::TextView > m_xDescriptionED
Definition: frmpage.hxx:280
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
std::unique_ptr< weld::RadioButton > m_xAnchorAtFrameRB
Definition: frmpage.hxx:99
const OUString & GetURL() const
Definition: fmturl.hxx:66
bool m_bIsMathOLE
Definition: frmpage.hxx:72
Size GetGraphicSizeTwip(const Graphic &rGraphic, vcl::RenderContext *pOutDev)
Definition: swtypes.cxx:28
bool m_bNoModifyHdl
Definition: frmpage.hxx:45
void setHeight(long nHeight)
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
std::unique_ptr< weld::RadioButton > m_xAnchorAtParaRB
Definition: frmpage.hxx:96
static OUString decode(OUString const &rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)