LibreOffice Module svx (master)
1
svx
source
sdr
contact
viewcontactofunocontrol.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 <
sal/config.h
>
21
22
#include <
sdr/contact/viewcontactofunocontrol.hxx
>
23
#include <
sdr/contact/viewobjectcontactofunocontrol.hxx
>
24
#include <
svx/sdr/contact/objectcontactofpageview.hxx
>
25
#include <
svx/svdouno.hxx
>
26
#include <
svx/svdpagv.hxx
>
27
#include <
svx/svdview.hxx
>
28
#include <
svx/sdrpagewindow.hxx
>
29
30
#include <
vcl/canvastools.hxx
>
31
#include <
basegfx/matrix/b2dhommatrix.hxx
>
32
#include <
drawinglayer/primitive2d/controlprimitive2d.hxx
>
33
#include <
drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
>
34
#include <osl/diagnose.h>
35
36
37
namespace
sdr::contact
{
38
39
40
using ::com::sun::star::awt::XControl;
41
using ::com::sun::star::uno::Reference;
42
using ::com::sun::star::awt::XControlContainer;
43
using ::com::sun::star::awt::XControlModel;
44
45
46
//= ViewContactOfUnoControl
47
48
ViewContactOfUnoControl::ViewContactOfUnoControl
(
SdrUnoObj
& _rUnoObject )
49
:
ViewContactOfSdrObj
( _rUnoObject )
50
{
51
}
52
53
54
ViewContactOfUnoControl::~ViewContactOfUnoControl
()
55
{
56
}
57
58
59
Reference< XControl >
ViewContactOfUnoControl::getTemporaryControlForWindow
(
60
const
vcl::Window
& _rWindow, Reference< XControlContainer >& _inout_ControlContainer )
const
61
{
62
SdrUnoObj
* pUnoObject =
dynamic_cast<
SdrUnoObj
*
>
(
TryToGetSdrObject
() );
63
OSL_ENSURE( pUnoObject,
"ViewContactOfUnoControl::getTemporaryControlForDevice: no SdrUnoObj!"
);
64
if
( !pUnoObject )
65
return
nullptr
;
66
return
ViewObjectContactOfUnoControl::getTemporaryControlForWindow
( _rWindow, _inout_ControlContainer, *pUnoObject );
67
}
68
69
70
ViewObjectContact
&
ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact
(
ObjectContact
& _rObjectContact )
71
{
72
// print or print preview requires special handling
73
const
OutputDevice
* pDevice = _rObjectContact.
TryToGetOutputDevice
();
74
ObjectContactOfPageView
*
const
pPageViewContact =
dynamic_cast<
ObjectContactOfPageView
*
>
( &_rObjectContact );
75
76
const
bool
bPrintOrPreview = pPageViewContact
77
&& ( ( ( pDevice != nullptr ) && ( pDevice->
GetOutDevType
() ==
OUTDEV_PRINTER
) )
78
|| pPageViewContact->
GetPageWindow
().
GetPageView
().
GetView
().
IsPrintPreview
()
79
)
80
;
81
82
if
( bPrintOrPreview )
83
return
*
new
UnoControlPrintOrPreviewContact
( *pPageViewContact, *
this
);
84
85
// all others are nowadays served by the same implementation
86
return
*
new
ViewObjectContactOfUnoControl
( _rObjectContact, *
this
);
87
}
88
89
90
void
ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence
(
drawinglayer::primitive2d::Primitive2DDecompositionVisitor
& rVisitor)
const
91
{
92
// create range. Use model data directly, not getBoundRect()/getSnapRect; these will use
93
// the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj)
94
// call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything
95
const
basegfx::B2DRange
aRange =
vcl::unotools::b2DRectangleFromRectangle
(
GetSdrUnoObj
().GetGeoRect());
96
97
// create object transform
98
basegfx::B2DHomMatrix
aTransform;
99
100
aTransform.
set
(0, 0, aRange.
getWidth
());
101
aTransform.
set
(1, 1, aRange.
getHeight
());
102
aTransform.
set
(0, 2, aRange.
getMinX
());
103
aTransform.
set
(1, 2, aRange.
getMinY
());
104
105
Reference< XControlModel > xControlModel =
GetSdrUnoObj
().
GetUnoControlModel
();
106
107
if
(xControlModel.is())
108
{
109
// create control primitive WITHOUT possibly existing XControl; this would be done in
110
// the VOC in createPrimitive2DSequence()
111
const
drawinglayer::primitive2d::Primitive2DReference
xRetval(
112
new
drawinglayer::primitive2d::ControlPrimitive2D
(
113
aTransform,
114
xControlModel,
115
nullptr
,
116
GetSdrObject
().
GetTitle
(),
117
GetSdrObject
().
GetDescription
()));
118
119
rVisitor.
visit
(xRetval);
120
}
121
else
122
{
123
// always append an invisible outline for the cases where no visible content exists
124
const
drawinglayer::primitive2d::Primitive2DReference
xRetval(
125
drawinglayer::primitive2d::createHiddenGeometryPrimitives2D
(
126
aTransform));
127
128
rVisitor.
visit
(xRetval);
129
}
130
}
131
132
133
}
// namespace sdr::contact
134
135
136
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
b2dhommatrix.hxx
canvastools.hxx
OutputDevice::GetOutDevType
OutDevType GetOutDevType() const
SdrPageView::GetView
SdrView & GetView()
Definition:
svdpagv.hxx:130
SdrPageWindow::GetPageView
SdrPageView & GetPageView() const
Definition:
sdrpagewindow.cxx:147
SdrPaintView::IsPrintPreview
bool IsPrintPreview() const
Definition:
svdpntv.hxx:510
SdrUnoObj
Definition:
svdouno.hxx:44
SdrUnoObj::GetUnoControlModel
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
Definition:
svdouno.hxx:88
basegfx::B2DHomMatrix
basegfx::B2DHomMatrix::set
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
basegfx::B2DRange
basegfx::Range2D::getWidth
TYPE getWidth() const
basegfx::Range2D::getMinX
TYPE getMinX() const
basegfx::Range2D::getMinY
TYPE getMinY() const
basegfx::Range2D::getHeight
TYPE getHeight() const
drawinglayer::primitive2d::ControlPrimitive2D
drawinglayer::primitive2d::Primitive2DDecompositionVisitor
drawinglayer::primitive2d::Primitive2DDecompositionVisitor::visit
virtual void visit(const Primitive2DReference &)=0
rtl::Reference
sdr::contact::ObjectContactOfPageView
Definition:
objectcontactofpageview.hxx:32
sdr::contact::ObjectContactOfPageView::GetPageWindow
SdrPageWindow & GetPageWindow() const
Definition:
objectcontactofpageview.hxx:42
sdr::contact::ObjectContact
Definition:
objectcontact.hxx:49
sdr::contact::ObjectContact::TryToGetOutputDevice
virtual OutputDevice * TryToGetOutputDevice() const
access to OutputDevice. May return 0L like the default implementations do. Override as needed.
Definition:
objectcontact.cxx:215
sdr::contact::UnoControlPrintOrPreviewContact
Definition:
viewobjectcontactofunocontrol.hxx:107
sdr::contact::ViewContactOfSdrObj
Definition:
viewcontactofsdrobj.hxx:32
sdr::contact::ViewContactOfSdrObj::TryToGetSdrObject
virtual SdrObject * TryToGetSdrObject() const override
override for accessing the SdrObject
Definition:
viewcontactofsdrobj.cxx:112
sdr::contact::ViewContactOfSdrObj::GetSdrObject
SdrObject & GetSdrObject() const
Definition:
viewcontactofsdrobj.hxx:44
sdr::contact::ViewContactOfUnoControl::getTemporaryControlForWindow
css::uno::Reference< css::awt::XControl > getTemporaryControlForWindow(const vcl::Window &_rWindow, css::uno::Reference< css::awt::XControlContainer > &_inout_ControlContainer) const
retrieves a temporary XControl instance, whose parent is the given window @seealso SdrUnoObj::GetTemp...
Definition:
viewcontactofunocontrol.cxx:59
sdr::contact::ViewContactOfUnoControl::GetSdrUnoObj
const SdrUnoObj & GetSdrUnoObj() const
Definition:
viewcontactofunocontrol.hxx:46
sdr::contact::ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence
virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
Definition:
viewcontactofunocontrol.cxx:90
sdr::contact::ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact
virtual ViewObjectContact & CreateObjectSpecificViewObjectContact(ObjectContact &_rObjectContact) override
Definition:
viewcontactofunocontrol.cxx:70
sdr::contact::ViewContactOfUnoControl::ViewContactOfUnoControl
ViewContactOfUnoControl(SdrUnoObj &_rUnoObject)
Definition:
viewcontactofunocontrol.cxx:48
sdr::contact::ViewContactOfUnoControl::~ViewContactOfUnoControl
virtual ~ViewContactOfUnoControl() override
Definition:
viewcontactofunocontrol.cxx:54
sdr::contact::ViewObjectContactOfUnoControl
Definition:
viewobjectcontactofunocontrol.hxx:49
sdr::contact::ViewObjectContactOfUnoControl::getTemporaryControlForWindow
static css::uno::Reference< css::awt::XControl > getTemporaryControlForWindow(const vcl::Window &_rWindow, css::uno::Reference< css::awt::XControlContainer > &_inout_ControlContainer, const SdrUnoObj &_rUnoObject)
retrieves a temporary XControl instance, whose parent is the given device @seealso SdrUnoObj::GetTemp...
Definition:
viewobjectcontactofunocontrol.cxx:1603
sdr::contact::ViewObjectContact
Definition:
viewobjectcontact.hxx:42
config.h
controlprimitive2d.hxx
GetDescription
virtual void GetDescription(OUString &rName) override
drawinglayer::primitive2d::createHiddenGeometryPrimitives2D
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
sdr::contact
GetTitle
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
vcl::unotools::b2DRectangleFromRectangle
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
objectcontactofpageview.hxx
OUTDEV_PRINTER
OUTDEV_PRINTER
sdrdecompositiontools2d.hxx
sdrpagewindow.hxx
OutputDevice
vcl::Window
svdouno.hxx
svdpagv.hxx
svdview.hxx
viewcontactofunocontrol.hxx
viewobjectcontactofunocontrol.hxx
Generated on Sun Jul 30 2023 04:28:12 for LibreOffice Module svx (master) by
1.9.3