Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
85b56737
Kaydet (Commit)
85b56737
authored
Mar 27, 2013
tarafından
Rafael Dominguez
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#60581 Import templates into current directory.
Change-Id: I965586748ab51ddb6face485e0db292c4c7b5274
üst
a544f366
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
6 deletions
+99
-6
templateabstractview.hxx
sfx2/inc/sfx2/templateabstractview.hxx
+2
-0
templatelocalview.hxx
sfx2/inc/sfx2/templatelocalview.hxx
+3
-0
templateabstractview.cxx
sfx2/source/control/templateabstractview.cxx
+26
-0
templatelocalview.cxx
sfx2/source/control/templatelocalview.cxx
+36
-0
templatedlg.cxx
sfx2/source/doc/templatedlg.cxx
+32
-6
No files found.
sfx2/inc/sfx2/templateabstractview.hxx
Dosyayı görüntüle @
85b56737
...
@@ -82,6 +82,8 @@ public:
...
@@ -82,6 +82,8 @@ public:
virtual
~
TemplateAbstractView
();
virtual
~
TemplateAbstractView
();
void
insertItem
(
const
TemplateItemProperties
&
rTemplate
);
// Fill view with new item list
// Fill view with new item list
void
insertItems
(
const
std
::
vector
<
TemplateItemProperties
>
&
rTemplates
);
void
insertItems
(
const
std
::
vector
<
TemplateItemProperties
>
&
rTemplates
);
...
...
sfx2/inc/sfx2/templatelocalview.hxx
Dosyayı görüntüle @
85b56737
...
@@ -70,6 +70,9 @@ public:
...
@@ -70,6 +70,9 @@ public:
bool
copyFrom
(
const
sal_uInt16
nRegionItemId
,
const
BitmapEx
&
rThumbnail
,
const
OUString
&
rPath
);
bool
copyFrom
(
const
sal_uInt16
nRegionItemId
,
const
BitmapEx
&
rThumbnail
,
const
OUString
&
rPath
);
// Import a template to the current region
bool
copyFrom
(
const
OUString
&
rPath
);
bool
copyFrom
(
TemplateContainerItem
*
pItem
,
const
OUString
&
rPath
);
bool
copyFrom
(
TemplateContainerItem
*
pItem
,
const
OUString
&
rPath
);
bool
exportTo
(
const
sal_uInt16
nItemId
,
const
sal_uInt16
nRegionItemId
,
const
OUString
&
rName
);
bool
exportTo
(
const
sal_uInt16
nItemId
,
const
sal_uInt16
nRegionItemId
,
const
OUString
&
rName
);
...
...
sfx2/source/control/templateabstractview.cxx
Dosyayı görüntüle @
85b56737
...
@@ -144,6 +144,32 @@ TemplateAbstractView::~TemplateAbstractView ()
...
@@ -144,6 +144,32 @@ TemplateAbstractView::~TemplateAbstractView ()
{
{
}
}
void
TemplateAbstractView
::
insertItem
(
const
TemplateItemProperties
&
rTemplate
)
{
const
TemplateItemProperties
*
pCur
=
&
rTemplate
;
TemplateViewItem
*
pChild
=
new
TemplateViewItem
(
*
this
);
pChild
->
mnId
=
pCur
->
nId
;
pChild
->
mnDocId
=
pCur
->
nDocId
;
pChild
->
mnRegionId
=
pCur
->
nRegionId
;
pChild
->
maTitle
=
pCur
->
aName
;
pChild
->
setPath
(
pCur
->
aPath
);
pChild
->
maPreview1
=
pCur
->
aThumbnail
;
if
(
pCur
->
aThumbnail
.
IsEmpty
()
)
{
// Use the default thumbnail if we have nothing else
pChild
->
maPreview1
=
TemplateAbstractView
::
getDefaultThumbnail
(
pCur
->
aPath
);
}
pChild
->
setSelectClickHdl
(
LINK
(
this
,
ThumbnailView
,
OnItemSelected
));
mItemList
.
push_back
(
pChild
);
CalculateItemPositions
();
Invalidate
();
}
void
TemplateAbstractView
::
insertItems
(
const
std
::
vector
<
TemplateItemProperties
>
&
rTemplates
)
void
TemplateAbstractView
::
insertItems
(
const
std
::
vector
<
TemplateItemProperties
>
&
rTemplates
)
{
{
std
::
vector
<
ThumbnailViewItem
*>
aItems
(
rTemplates
.
size
());
std
::
vector
<
ThumbnailViewItem
*>
aItems
(
rTemplates
.
size
());
...
...
sfx2/source/control/templatelocalview.cxx
Dosyayı görüntüle @
85b56737
...
@@ -590,6 +590,42 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
...
@@ -590,6 +590,42 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
return
false
;
return
false
;
}
}
bool
TemplateLocalView
::
copyFrom
(
const
OUString
&
rPath
)
{
assert
(
mnCurRegionId
);
TemplateContainerItem
*
pRegItem
=
maRegions
[
mnCurRegionId
-
1
];
sal_uInt16
nId
=
getNextItemId
();
sal_uInt16
nDocId
=
0
;
sal_uInt16
nRegionId
=
pRegItem
->
mnRegionId
;
String
aPath
(
rPath
);
if
(
!
pRegItem
->
maTemplates
.
empty
())
nDocId
=
(
pRegItem
->
maTemplates
.
back
()).
nDocId
+
1
;
if
(
!
mpDocTemplates
->
CopyFrom
(
nRegionId
,
nDocId
,
aPath
))
return
false
;
TemplateItemProperties
aTemplate
;
aTemplate
.
aIsFolder
=
false
;
aTemplate
.
nId
=
nId
;
aTemplate
.
nDocId
=
nDocId
;
aTemplate
.
nRegionId
=
nRegionId
;
aTemplate
.
aName
=
aPath
;
aTemplate
.
aThumbnail
=
TemplateAbstractView
::
fetchThumbnail
(
rPath
,
TEMPLATE_THUMBNAIL_MAX_WIDTH
,
TEMPLATE_THUMBNAIL_MAX_HEIGHT
);
aTemplate
.
aPath
=
rPath
;
pRegItem
->
maTemplates
.
push_back
(
aTemplate
);
insertItem
(
aTemplate
);
return
true
;
}
bool
TemplateLocalView
::
copyFrom
(
TemplateContainerItem
*
pItem
,
const
OUString
&
rPath
)
bool
TemplateLocalView
::
copyFrom
(
TemplateContainerItem
*
pItem
,
const
OUString
&
rPath
)
{
{
sal_uInt16
nId
=
1
;
sal_uInt16
nId
=
1
;
...
...
sfx2/source/doc/templatedlg.cxx
Dosyayı görüntüle @
85b56737
...
@@ -884,15 +884,41 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
...
@@ -884,15 +884,41 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
if
(
aFiles
.
hasElements
())
if
(
aFiles
.
hasElements
())
{
{
std
::
set
<
const
ThumbnailViewItem
*
,
selection_cmp_fn
>::
const_iterator
pIter
;
if
(
!
maSelFolders
.
empty
())
for
(
pIter
=
maSelFolders
.
begin
();
pIter
!=
maSelFolders
.
end
();
++
pIter
)
{
{
OUString
aTemplateList
;
//Import to the selected regions
TemplateContainerItem
*
pFolder
=
(
TemplateContainerItem
*
)(
*
pIter
);
std
::
set
<
const
ThumbnailViewItem
*
,
selection_cmp_fn
>::
const_iterator
pIter
;
for
(
pIter
=
maSelFolders
.
begin
();
pIter
!=
maSelFolders
.
end
();
++
pIter
)
{
OUString
aTemplateList
;
TemplateContainerItem
*
pFolder
=
(
TemplateContainerItem
*
)(
*
pIter
);
for
(
size_t
i
=
0
,
n
=
aFiles
.
getLength
();
i
<
n
;
++
i
)
{
if
(
!
maView
->
copyFrom
(
pFolder
,
aFiles
[
i
]))
{
if
(
aTemplateList
.
isEmpty
())
aTemplateList
=
aFiles
[
i
];
else
aTemplateList
=
aTemplateList
+
"
\n
"
+
aFiles
[
i
];
}
}
if
(
!
aTemplateList
.
isEmpty
())
{
OUString
aMsg
(
SfxResId
(
STR_MSG_ERROR_IMPORT
).
toString
());
aMsg
=
aMsg
.
replaceFirst
(
"$1"
,
pFolder
->
maTitle
);
ErrorBox
(
this
,
WB_OK
,
aMsg
.
replaceFirst
(
"$2"
,
aTemplateList
));
}
}
}
else
{
//Import to current region
OUString
aTemplateList
;
for
(
size_t
i
=
0
,
n
=
aFiles
.
getLength
();
i
<
n
;
++
i
)
for
(
size_t
i
=
0
,
n
=
aFiles
.
getLength
();
i
<
n
;
++
i
)
{
{
if
(
!
maView
->
copyFrom
(
pFolder
,
aFiles
[
i
]))
if
(
!
maView
->
copyFrom
(
aFiles
[
i
]))
{
{
if
(
aTemplateList
.
isEmpty
())
if
(
aTemplateList
.
isEmpty
())
aTemplateList
=
aFiles
[
i
];
aTemplateList
=
aFiles
[
i
];
...
@@ -904,7 +930,7 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
...
@@ -904,7 +930,7 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
if
(
!
aTemplateList
.
isEmpty
())
if
(
!
aTemplateList
.
isEmpty
())
{
{
OUString
aMsg
(
SfxResId
(
STR_MSG_ERROR_IMPORT
).
toString
());
OUString
aMsg
(
SfxResId
(
STR_MSG_ERROR_IMPORT
).
toString
());
aMsg
=
aMsg
.
replaceFirst
(
"$1"
,
pFolder
->
maTitle
);
aMsg
=
aMsg
.
replaceFirst
(
"$1"
,
maView
->
getCurRegionName
()
);
ErrorBox
(
this
,
WB_OK
,
aMsg
.
replaceFirst
(
"$2"
,
aTemplateList
));
ErrorBox
(
this
,
WB_OK
,
aMsg
.
replaceFirst
(
"$2"
,
aTemplateList
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment